**Background:** Substance use disorders (SUDs) affect an estimated 284 million people worldwide, with MDMA (Ecstasy) being a widely used amphetamine derivative that causes serotonin/dopamine release, tolerance, anxiety, and depression. Recent evidence links the gut microbiome to CNS function via the microbiome–gut–brain axis, and psychoactive substances can alter microbial composition. Medicinal plants like Anacyclus pyrethrum L. (Asteraceae) have neuropharmacological effects including GABA modulation, anti-inflammatory, and antioxidant properties, but their impact on the gut microbiome in the context of SUDs had not been studied. This study aimed to investigate whether MDMA alters gut microbial communities in rats and whether post-treatment with AEAP could mitigate MDMA-induced behavioral, biochemical, and microbiome changes.
**Methods:** Male Sprague–Dawley rats (210 ± 20 g) were divided into four groups (n = 6 each): vehicle (saline), MDMA-dependent (10–20 mg/kg/day escalating dose for 30 days by gavage), AEAP alone (200 mg/kg/day for 7 days), and MDMA + AEAP (MDMA for 30 days followed by AEAP for 7 days). Behavioral tests included conditioned place preference (CPP) for dependence, elevated plus maze (EPM) for anxiety, open field test (OFT) for locomotor activity, and Porsolt's forced swim test (FST) for depression-like behavior. Serum cortisol, urea, and creatinine were measured. Gut microbiota was analyzed by culturing on blood agar, colony counting, and MALDI-TOF MS protein fingerprinting for bacterial identification at genus level.
**Key Results:** MDMA significantly increased CPP (650 s in MDMA-paired chamber vs. vehicle, p < 0.01), indicating dependence. In the withdrawal phase, MDMA rats showed reduced open arm time/entries in EPM (p < 0.001), decreased rearing and line crossings in OFT (p < 0.001 and p < 0.01), and increased immobility time in FST (p < 0.001) vs. controls. Cortisol was significantly elevated in the MDMA group (p < 0.001). Urea and creatinine showed no significant differences. MDMA reduced total bacterial density (15 × 10^5 CFU/mL vs. 25.5 × 10^5 in controls, p < 0.001) and altered composition: Rodentibacter (5% vs. 15%, p < 0.001), Corynebacterium (10% vs. 50%, p < 0.001), Staphylococcus (2% vs. control), and Lactobacillus were decreased, while Escherichia coli increased (6% vs. control, p < 0.001). AEAP post-treatment reversed many effects: CPP time decreased to 500 s, EPM open arm time/entries increased (p < 0.001 vs. initial phase), OFT rearing and crossings increased (p < 0.01 vs. vehicle), FST immobility decreased (p < 0.01), and cortisol normalized. AEAP alone or with MDMA increased Lactobacillus (60%), Staphylococcus (10%), and Bifidobacterium (10%) abundance. The AEAP group showed the highest bacterial density (60 × 10^5 CFU/mL, p < 0.001).
**Clinical Implications:** This is the first study to demonstrate that MDMA induces gut microbiome dysbiosis in rats and that AEAP post-treatment can partially reverse MDMA-induced behavioral, biochemical, and microbial alterations. The findings support the role of the microbiome–gut–brain axis in SUDs and suggest that plant-derived psychobiotics like A. pyrethrum may offer a novel therapeutic strategy. The increase in Lactobacillus, Bifidobacterium, and Staphylococcus—known GABA and dopamine producers—may underlie the anxiolytic and antidepressant effects. However, the study is limited by its small sample size (n = 6/group), use of a single AEAP dose, and lack of mechanistic molecular pathway analysis. Further clinical and mechanistic studies are needed to validate these findings in humans and elucidate the signaling pathways involved.