BACKGROUND: Aerobic vaginitis (AV) caused by abnormal aerobic bacterial infections is characterized by inflammation and dysbiosis of vaginal microbiota. The traditional herbal medicine, Mahonia fortunei, has shown potential anti-inflammatory and antimicrobial properties, which could be beneficial for treating AV. METHODS: In this study, both low-dose and high-dose Mahonia fortunei treatments were administered to AV model rats induced by Staphylococcus aureus infection. Vaginal pH levels, bacterial infection and neutrophil infiltration were measured. Network pharmacology analysis was conducted to identify bioactive ingredients, and 16S rDNA analysis was used to study the vaginal microbiota composition and explain the mechanisms of inflammatory action. RESULTS: The results indicated that Mahonia fortunei significantly reduced vaginal pH, alleviated bacterial infections and decreased neutrophil infiltration in AV rats. Bioactive compounds such as berberine, coptisine and palmatine were selected for network pharmacological analysis. Kyoto Encyclopedia of Genes and Genomes analysis showed that Mahonia fortunei downregulated inflammatory pathways such as Janus kinase/signal transducer and activator of transcription and nuclear factor kappa B cell, thereby reducing proinflammatory cytokines interleukin-1. Additionally, Mahonia fortunei restored vaginal microbiota diversity, particularly increasing Gammaproteobacteria, a crucial biomarker for vaginal dysbiosis, and downregulating oxidative phosphorylation and stress-related pathways, reducing oxidative stress and inflammation. CONCLUSION: Mahonia fortunei exhibited significant therapeutic potential in treating AV by regulating vaginal microbiota, reducing inflammation, and restoring vaginal health.