In Star Trek, the fundamental concept of warp drive requires anti-matter and matter combinations to produce the needed energy. Yet, despite this importance, I haven't come across any reference to how antimatter is produced (Memory Alpha contained no hints). So how is antimatter produced in the 23rd or 24th centuries?
The semi-canonical Star Trek: The Next Generation Technical Manual is deliberately vague on this, just referring to some unknown form of "charge reversal devices" on p. 67, but they do at least specify that Starfleet has special facilities for antimatter production:
As used aboard the USS Enterprise, antimatter is first generated at major Starfleet fueling facilities by combined solar-fusion charge reversal devices, which process proton and neutron beams into antideuterons, and are joined by a positron beam accelerator to produce antihydrogen (specifically antideuterium). Even with the added solar dynamo input, there is a net energy loss of 24% using this process, but this loss is deemed acceptable by Starfleet to conduct distant interstellar operations.
Today, very small amounts of antimatter are produced. Most are in the form of positrons, some are produced in the form of anti-protons, and there are a few labs making anti-hydrogen (a full positron/anti-proton pair).
It takes more energy to make it than would be released if it was utilized. This is a basic principle of physics, after all.
There is a nuclear fission principle though, that of the "breeder reaction". They experimented with this sort of nuclear reactor until the 1980s or so. It exploited some weird side reactions, such that as you cooked the uranium (plutonium? I'm not familiar with the details) it also cooked the other radioactive elements in the fuels rods turning them into more fuel.
Hypothetically, if there were a similar reaction for antimatter, such that annihilating it with matter caused nearby particles to convert into antimatter, then you would be able to make more of the stuff easily. It would be sort of like if when using gasoline in a internal combustion engine it caused the air to spontaneously turn into gasoline. Only, with antimatter there might be some formulation of this that didn't necessarily violate entropy.
I've also read other theories that suppose that you might "rotate" normal matter through higher dimensions, such that when it reappeared to us in our dimension it would have become antimatter. Of course, every few weeks someone is claiming that there are 30 higher dimensions or none, so this might be bunk too.
Star Trek itself has mostly been silent on the details of its own process, for the same reason that we never see the cops on Law and Order ever bother to fill up the gas tanks of their department-issued vehicles.
I think we must assume starships regularly hang in close orbit around stars, there converting solar energy into matter and antimatter (and storing the antimatter). Stars have loads of energy. But the trick is carrying this compact form of energy between stars. Between stars, one can't just convert a natural and close source of solar energy into antimatter since the nearest source of energy is often many light years away. Between stars, the energy is too weak and it would take too long to gather sufficient energy to make any appreciable amount of antimatter. Thus, starships (not shown actually doing this since it's boring, like filling up at a gas station) collect solar energy whenever they are low on antimatter and close to a star and they have time, and thus produce and store antimatter for later use between stars. How long this takes, we do not know, but we must further assume it does not take too long and they have highly efficient solar energy converters. Otherwise, you'd have to account for huge time lags in the story while they did this.