I have only encountered the inverse Lagrangian problem in mathematics books that treat Lagrangian field theory using jet bundles and homological algebra, and while I am studying this approach, I still find the language somewhat difficult to understand/use.
In a more familiar, however much less precise formalism, I thought about the following.
If one's given a field $\psi$ and an action $$ S[\psi]=\int d^nx\ \mathcal L(\psi,\partial\psi)$$ for this field, the Euler-Lagrange equations are given by $$ E\mathcal L(x)=\frac{\delta S[\psi]}{\delta\psi(x)}=0. $$ The functional derivative here is an analogue of the gradient in finite dimensional calculus.
Naively, using finite dimensional intuition, one can argue that $$ \frac{\delta^2S[\psi]}{\delta\psi(x)\delta\psi(y)} $$ is symmetric in $x,y$, and if an analogue of the Poincaré's lemma holds for "functionals" as well, then for a "functional" (more like a nonlinear operator, really) $F[\psi](x)$ it holds that $$ \frac{\delta}{\delta\psi(y)}F[\psi](x)=\frac{\delta}{\delta\psi(x)}F[\psi](y), $$ then "locally" there should be a functional $$ S[\psi] $$ such that $$ F[\psi](x)=\frac{\delta}{\delta\psi(x)}S[\psi]. $$
However, then, the inverse Lagrangian problem can be attacked as such:
Assume that a field $\psi$ is given with field equations $E[\psi](x)=0$, where $E[\psi](x)$ is some local function/field that depends on $\psi$ and its derivatives. If the equations of motion come from a variational principle, then $E[\psi]$ is "functionally exact", so the "functional exterior derivative" $$ \mathcal{D}E[\psi](x,y)=\frac{\delta}{\delta\psi(x)}E[\psi](y)-\frac{\delta}{\delta\psi(y)}E[\psi](x) $$ should vanish, and by Poincaré's lemma, there is at least a "locally defined" action functional for $E$.
Questions:
Is this approach in any way tenable? As in is there a functional version of Poincaré's lemma? If so it seems to me that determining whether a field equation is variational or not is reducible to a mechanical calculation.
If there is a functional Poincaré's lemma, is there any explicitly calculable homotopy operator for it? The usual proof of Poincaré's lemma in finite dimensions also constructs the homotopy operator explicitly, and it can be used to calculate primitive forms.
Now, as a note, I'll say that probably this approach is not well defined in the rigorous sense, but physicists have a way of doing infinite-dimensional calculations via very very unrigorously used distributions and such pretty effectively, even if things are ill-defined mathematically, so I am only expecting answers on that level of rigour.