Unless you want to assume that the court is so broken, it will willy-nilly convict innocents.
But then it doesn't matter much what the prosecutor does, then the justice system is utterly broken.
Racial disparities, emphasis on victimless crime, asset forfeiture, prison overcrowding, and oh, the fact that USA has a much higher incarceration rate than any comparable polity ever in the history of the human race.
E.g. a society is generally entitled to criminalize activities it does not want people to engage in. That some other people may perceive the crimes as "victimless" is neither here nor there. I'd imagine that very few people convicted of drug crimes are not in fact guilty of those crimes, because the evidence in those cases is usually overwhelming (e.g. caught with physical product in hand).
Similarly, the U.S. has had about 5-10x the murder rate of, say, the U.K., going back probably a century or more, long before the recent rise in incarceration rate. So the fact that the U.S. has a high incarceration rate does not by itself mean that innocent people are being put in prison.
And anyone is ever guilty only because we define it to be so. In the state of nature, robbing a store and killing the clerk is simply the stronger animal exercising its free will over the weaker. And if robbery is illegal because we say so, I fail to see how the robber is less guilty of the crime because one country punishes him with 3 years in prison while we punish him with 10.
I don't see "don't smoke or sell pot" anywhere in the Ten Commandments.
For one, they are obligated to investigate any exonerating evidence and circumstances, and any exculpatory circumstances. All of this must be revealed fully to the court and the defense, prior to the main trial.
For another, they must only charge when they believe that a conviction is more probable than an acquittal ("my chances are at best 20%, but let's see how it goes" would be clear misconduct).
In practice, the conviction rates are more than 90%, for sure (if you count a conviction for a lesser crime).
As a prosecutor once told me: trials can be freak events. After listening to the witnesses firsthand, or after some dramatic revelation, everything can look much different than it looked in the file. But other than that, they almost always win at least partially.
And another reason is workload. Apart from really high profile, highly publicized cases, resources are extremely limited and prosecutors mostly try to close the files.