Chronic prostatitis/chronic pelvic pain syndrome (CP/CPPS) is a very common urological disorder and has been gradually regarded as an immune-mediated disease. Multiple studies have indicated that the gut microflora plays a pivotal part in immune homeostasis and autoimmune disorder development. However, whether the gut microflora affects the CP/CPPS, and the underlying mechanism behind them remain unclear. Here, we built an experimental autoimmune prostatitis (EAP) mouse model by subcutaneous immunity and identified that its Th17/Treg frequency was imbalanced. Using fecal 16s rRNA sequencing and untargeted/targeted metabolomics, we discovered that the diversity and relative abundance of gut microflora and their metabolites were obviously different between the control and the EAP group. Propionic acid, a kind of short-chain fatty acid (SCFA), was decreased in EAP mice compared to that in controls, and supplementation with propionic acid reduced susceptibility to EAP and corrected the imbalance of Th17/Treg cell differentiation in vivo and in vitro. Furthermore, SCFA receptor G-protein-coupled receptor 43 and intracellular histone deacetylase 6 regulated by propionic acid in Th17 and Treg cells were also evaluated. Lastly, we observed that fecal transplantation from EAP mice induced the decrease of Treg cell frequency in recipient mice. Our data showed that gut dysbiosis contributed to a Th17/Treg differentiation imbalance in EAP via the decrease of metabolite propionic acid and provided valuable immunological groundwork for further intervention in immunologic derangement of CP/CPPS by targeting propionic acid.