As suggested by @my2cts, from this post, I want to know if the divergenceless of energy-momentum energy tensor is valid for any (possibly curved) metric $g_{\mu\nu}$?
Here the formula with $g_{\mu\nu}$ (I think the author has taken a Minkowski pseudo-metric $\eta_{\mu\nu}$ in this formula but I am not sure)
$$\nabla_{\mu} T^{\mu \nu} = 0\tag{1}$$
$$T^{\mu \nu} = \frac{1}{\mu_{0}}\Big[F^{\alpha \mu} F^{\nu}_{\alpha} - \frac{1}{4}g^{\mu \nu}F^{\alpha \beta}F_{\alpha \beta}\Big]\tag{2}$$
Is this also the case in not-vacuum space?