Graphene-based warm uterus acupoint paste (GWUAP) is an emerging non-drug alternative therapy for the treatment of primary dysmenorrhea (PD), but the underlying mechanism is still unclear. SD female rats were randomly divided into control group, model group and treatment group to explore the mechanism of GWUAP in the treatment of PD. Combined with 16S rDNA and fecal metabolomics, the diversity of microbiota and metabolites in each group was comprehensively evaluated. In this study, GWUAP reduced the torsion score of PD model rats, improved the pathological morphology of uterine tissue, reduced the pathological damage score of uterine tissue, and reversed the expression levels of inflammatory factors, pain factors and sex hormones. The 16 S rDNA sequencing of fecal samples showed that the abundance of Lactobacillus in the intestinal flora of the model group decreased and the abundance of Romboutsia increased, while the abundance of Lactobacillus in the intestinal flora of the treatment group increased and the abundance of Romboutsia decreased, which improved the imbalance of flora diversity in PD rats. In addition, 32 metabolites related to therapeutic effects were identified by metabolomics of fecal samples. Moreover, there is a close correlation between fecal microbiota and metabolites. Therefore, the mechanism of GWUAP in the treatment of PD remains to be further studied.