IntroductionHeroin use disorder (HUD) is commonly accompanied by gut dysbiosis, but the roles of gut microbiota in HUD treatment, such as compulsory detoxification and methadone maintenance treatment (MMT), remain poorly understood.MethodsIn this study, we performed 16 s rDNA and whole metagenome sequencing to analyze the gut microbial profiles of HUD patients undergoing heroin addiction, heroin withdrawal (compulsory detoxification), and MMT.ResultsOur findings revealed that, compared to healthy controls, microbial diversity was significantly decreased in HUD patients who were in a state of heroin addiction and withdrawal, but not in those receiving MMT. We observed significant alterations in 10 bacterial phyla and 20 bacterial families in HUD patients, while MMT partially restored these changes. Whole metagenome sequencing indicated gut microbiota functions were significantly disrupted in HUD patients experiencing heroin addiction and withdrawal, but MMT was found to almost reverse these dysfunctions. In addition, we identified 24 featured bacteria at the genus level that could be used to effectively distinguish between healthy individuals and those with heroin addiction, heroin withdrawal, or receiving MMT. Furthermore, we found the relative abundance of Actinomyces, Turicibacter and Weissella were positively associated with the Hamilton Depression Scale score in different states of HUD patients.DiscussionThis study provides evidence from the gut microbiota perspective that MMT is a more effective approach than compulsory detoxification for HUD treatment.