Solution (source code)

= Solution

For a real field, $\phi_{-\mathbf k}=\phi_{\mathbf k}^*$. The stated <Fourier transform> gives
$$
\nabla\phi(\mathbf x)=\int\frac{d^dk}{(2\pi)^d}\,i\mathbf k e^{i\mathbf k\cdot\mathbf x}\phi_{\mathbf k}.
$$
Using
$$
\int d^dx\,e^{i(\mathbf k+\mathbf q)\cdot\mathbf x}
=(2\pi)^d\delta^{(d)}(\mathbf k+\mathbf q)
$$
in both quadratic terms yields
$$
F[\phi]
=\frac12\int\frac{d^dk}{(2\pi)^d}
(\gamma k^2+\mu^2)|\phi_{\mathbf k}|^2.
$$