The Federation has an excessive amount of clean, renewable energy sources, they produce so much energy and use it so efficiently that they don't know where to put it. And then they mastered the technology of turning energy into matter and vice versa.
This would work only if the federation knows how to break conservation of energy (it doesn't, as per the entirety of star trek).
You seem to have no idea how much energy is needed in order to create, for example, 1 kg of atoms.
This would be the energy produced by +1/2 kg antimatter and +1/2 kg matter (assuming the federation can efficiently capture and use neutrinos). In other words, enough to atomically blow up an entire continent (easily).
The energy generators shown in star trek (matter/antimatter and fusion generators) are not powerful enough - by orders of magnitude - in order for energy so wastefully used to be plentiful.
Well, apparently they are, because they do all that stuff on a regular basis, don't they?