I was wondering if it is possible to construct a Lagrangian $\mathcal{L}$ such that the first variation of the action $\mathcal{S}(f, g)$ in the second argument $g$ yields the Poisson bracket of $f$ and $g$? That is, can we find an $\mathcal{L}$ such that
\begin{align} \mathcal{S}(f, g) &= \int_{\Omega^{2}} \mathcal{L}(x, y, f, \nabla f, g, \nabla g) \ dx dy \\ \implies \frac{\delta \mathcal{S}(f, g)}{\delta g} &= \frac{d}{d \epsilon} \left[ \int_{\Omega^{2}} \mathcal{L} (x, y, f, \nabla f, g + \epsilon \phi, \nabla g + \epsilon \nabla \phi) \ dx dy \right]_{\epsilon = 0} \\ &= \int_{\Omega^{2}} \{f, g \} \phi \ dx dy \end{align}
where
$$\{f, g \} := \partial_{x} f \partial_{y} g - \partial_{y} f \partial_{x} g$$
? Note that variation must be with respect to the second argument only. If we consider the Euler-Lagrange equation (it is this particular ELE because we are only computing the variation in $g$) for it, we are looking to solve
\begin{equation} \partial_{g} \mathcal{L} - \partial_{x} (\partial_{g_{x}} \mathcal{L}) - \partial_{y} (\partial_{g_{y}} \mathcal{L}) = \{f, g \} \end{equation}
which I have been unable to do (I'm essentially down to guessing and checking). I know the inverse problem of finding a Lagrangian given a PDE can be quite difficult, so I'm not expecting much, but considering the Poisson bracket is ubiquitous in classical mechanics I thought someone here may know how to get it from the action or possibly provide a reference.
Edit:
I also think I remember reading somewhere that it is difficult to get first derivatives, if not impossible, from minimising an action, as using integration by parts on the gradient of the perturbation $\nabla \phi$ necessarily gives a second derivative. For example, assuming the boundary conditions make the evaluated terms vanish, we have
$$\int_{\Omega} \nabla g \cdot \nabla \phi dx = - \int_{\Omega} \phi \nabla^{2} g dx$$
and so we can't ever get a single derivative acting on $g$. If this is true then my question is easily answered. However, I am not totally sure of this and I can't find anything online to back up this statement. Could anyone confirm this?
Edit 2 (17/07/23):
Adding the answers provided in this question for reference.