First and foremost you will need a prison with 100+ Prisoners.
You will also need to do this on a standard difficulty, so County, Federal or Super-Max. It cannot be done on custom.
You will also need to have a Psychologist on Site (the more you have the more sessions you can run) and a medical wing with Medical beds.
If you hover over a prisoner, you can see his wants and needs, the idea is to get 100+ prisoners with their needs for Drug/Alcohol below 25%. The psychologist can run reform programs in a common room to help with Alcohol abuse, the more chairs the more people can attend a given session up to a maximum of 20 per room/per Psychologist. It takes 10 sessions to pass the course, so it might be wise to run a few separate sessions to speed things up. Each session takes 2 hours so make sure you allow for 2 hours work time on the regime for people to attend.
For Drug abuse you will need Doctors and Medical beds. You can have 10 prisoners attend per session so you will need 10 medical beds to maximize efficiency. You will also need at least 1 Doctor per session being run. This is a lot quicker than Alcohol abuse programs as they only take 3 sessions and last an hour each, they also have a chance to completely remove the need for drugs which cannot be done for alcohol abuse.
The quickest way to go about this would be to have a prison with an excess of 100+ prisoners, the more the quicker it will go. Then have multiple sessions for both Alcohol and drug abuse running concurrently. I personally ran 2 common rooms with a psychologist in each and 3 Infirmaries running Drug abuse reform. I also allowed 6 hours for Work/Freetime in the evening, however my prison was heavily based on Reform and Rehabilitation so yours might differ.
Another thing to mention is that the higher the punishment/Suppression of a prison the less likely prisoners will be to attend these classes. Try make sure all your prisoners needs are attended to, and reduce the amount of armed guards they see, random searches they experience etc etc. Try reduce the amount of Narcotics entering the prison as well, Guard dogs in places like delivery and at choke points can sniff out smelly contraband like drugs or cigarettes. Cutting off the supply might annoy some prisoners, but it is a lot easier to get prisoners off drugs when there are no drugs around.
Message me if there's any further questions.