Judging form 90s Trek though I'd say "people in lab coats that 'cure' criminals of being criminals" is one of those things that only apply to the TOS version of Star Trek
Well, TNG still refrained from suggesting a conventional punitive system, and actually mentioned futuristic screening against criminal tendencies in "Justice", that is, a belief that crime starts from a "seed". And DS9 featured the same "punishment" for smuggling of medicine and attempted genocide, that is, an absence of about six months - no punitive system could work that way, but forced therapy easily could.
And if you think about it, the government having behaviour altering powers like that very much does have the potential for dystopia.
OTOH, a government that has the power to frighten people out of crime by using freedom-deprivation torture doesn't leave anything at "potential". Worse still when the "power" actually doesn't work all that well...
In 90s Trek the Federation still seems to employ imprisonment as penalty.
The only time we hear of a sentence of a determined length, rather than a brief absence after which the culprit never repeats the crime, is with Richard Bashir's crime. Perhaps an ancient punishment goes with an ancient offense there?
Ro Laren also didn't seem to be "cured" of criminal behaviour, considering she defected to join the Marquis.
She never received therapy for that, though - this was her first offense.
The system as described in TOS doesn't turn people into sheep. Mudd appears to have been a recipient, perhaps several times. We never ever hear of him being a repeat offender, though: he's inventive enough to avoid that. Surely this is preferable in brainwashing, so that only the absolute minimum is taken away from the patient.
Then again, maybe behaviour altering rehabilitation might be restricted for extreme cases such as murder.
Its first mention is with Mudd's petty crimes in "Mudd's Women", though. It seems to have been quite a success, as Mudd persists with petty, but not with any of the variants listed.
Maybe there was a whole controversy in the Federation and Starfleet on when and if to employ such methods.
...And "Dagger of the Mind" has our heroes describe the aftermath, with Dr. Adams' therapies the winner of the debate and a success story where decades of good work have finally thoroughly reformed crime management within Kirk's career.
Might even be Kirk is especially close to the world of crime management, as he knows penal colony protocol and appears to be a frequent (and perhaps even sole!) visitor to the special Elba II facility for incurables. He doesn't seem put off by Adams' excesses much, not in the subsequent Elba II adventure.
Is Kirk's position a controversial one? A decade prior, Cmdr Burnham got life for attempting (and succeeding in!) the igniting of interstellar war. Her organization still handed out death sentences on occasion, but not for this rather horrid crime. Kirk seems reasonably comfortable with the persisting capital punishment, but does consider the system to be in flux in "Dagger" and himself contributes to it in "The Menagerie"; if controversy existed, this would be the time to bring it up. Instead, it seems Adams is the coming thing and punishment is the departing one.
Fear of it getting out of hand could be a factor why colonies might choose not to join or leave the Federation (because otherwise I fail to understand why planets like New Sydney would go back to money based economy and the crime and penalty that goes along with that, unless New Sydney was founded before money became obsolete?)
Might be it takes the federal machinery to hand out free lunches to all citizens, and lesser outfits can't afford that - but money still runs the show behind the scenes, with only the consumer market totally eliminated. There's riches to be made in industry, but perhaps more riches if you sever ties with the free-lunch bunch and accept that on the rare occasion you might have to pay for yours.
But we see quite a zoo of colonies out there, and they tend to have specific rather than common grievances. Gathering a small bunch of people and sailing to the stars is quite often done in order to perpetuate a way of life, real or imagined, even when the perpetuators fully acknowledge that the way is inferior to the UFP one in most respects (hard work, strict rules, mental policing, racial strife and whatnot). No single grievance against the UFP way of life seems to emerge, only the lament that the UFP is uniform and sterile and doesn't cater for affable cultural stereotypes or selfish esoteria.
Timo Saloniemi