Long-term stress causes hyperalgesia; and there are gender differences in the mechanism of pain in male and female individuals. The role of gut microbiota in pain has also been verified. However, whether gut microbiota plays a role in hyperalgesia caused by chronic restraint stress (CRS) with gender differences has not been explored. This study investigated the role of gut microbiota in CRS-induced hyperalgesia gender-specifically through 16S ribosomal RNA (16S rRNA) gene sequencing and untargeted metabolomic analysis using liquid chromatography-mass spectrometry (LC-MS). The study found that both male and female mice experienced hyperalgesia after CRS and antibiotic treatment. 16S rRNA gene sequencing reveals gender differences in the fecal microbiota induced by CRS. The pain threshold decreased after transplanting the fecal microbiota from the male and female CRS group to the corresponding pseudo-germ-free mice. In addition, this study detected gender differences in the host gut microbiota and serum metabolism induced by fecal microbiota transplantation (FMT). Specifically, the different serum metabolites between the pseudo-germ-free mice receiving FMT from the CRS group and those from the control group were mainly involved in bile secretion and steroid hormone biosynthesis for male mice, and in taurine and hypotaurine metabolism and tryptophan metabolism for female mice. In summary, the gut microbiota participates in stress-induced hyperalgesia (SIH) with gender differences by influencing the host's gut microbiota composition and serum metabolism. Therefore, our findings provided insights into developing novel gut microbiota-associated drugs for the management of gender-specific SIH.