Here is one line of reasoning: E&M is supposed to be a fundamental theory. Having an action principle may facilitate developing a consistent quantum theory. The structure of the Maxwell Lagrangian density $$ {\cal L}~=~-\frac{1}{4}F_{\mu\nu}F^{\mu\nu} + j_{\mu}A^{\mu}$$$$ {\cal L}~=~-\frac{1}{4}F_{\mu\nu}F^{\mu\nu} + j^{\mu}A_{\mu}$$ does not depend on the spacetime dimension $n$. It possesses Lorentz &symmetry. It possesses gauge symmetry (if $d_{\mu}j^{\mu}=0$). Its Euler-Lagrange equations imply a Gauss law, and hence in the electrostatic limit, a Coulomb force law that falls off as $1/r^{n-2}$. For more details, see also my related Phys.SE answers here & here.