Objective: Metformin exhibits therapeutic potential in behavioural deficits induced by methamphetamine (METH) in rats. Emerging studies suggest gut microbiota may impact psychiatric symptoms, but there is no direct evidence supporting metformin's participation in the pathophysiology of withdrawal symptoms via modulation of gut microbiota. Methods: In order to define the functional contributions by gut microbiota and metformin to the behavioural deficits during METH withdrawal, we utilized a combination of fecal microbiota transplantation (FMT), high-throughput sequencing, and untargeted metabolomics technologies. Results: First, METH addicts exhibited higher alpha diversity and distinct microbial structures compared to heathy controls. In particular, the relative abundance of Rikenellaceae was positively correlated with the severity of anxiety and depression. Second, both human-to-mouse and mouse-to-mouse FMTs confirmed that METH-altered-microbiota transplantation is sufficient to promote anxiety and depression-like behaviours in recipient germ-free mice, and these behavioural disturbances could be ameliorated by metformin. In-depth analysis revealed that METH significantly altered the bacterial composition and structure as well as relative abundance of several bacterial taxa and metabolites, including Rikenellaceae and inosine, respectively, whereas add-on metformin could remodel these alterations. Finally, the inosine complementation successfully restored METH-induced anxiety and depression-like behaviours in mice. Discussion: This study demonstrates that METH withdrawal-induced anxiety and depression-like behaviours are convertible and transmissible via gut microbiota in a mouse model. The therapeutic effects of metformin on psychiatric manifestations are associated with microbiota-derived metabolites, highlighting the role of the gut microbiota in substance use disorders and the pathophysiology of withdrawal symptoms.