The Th17/Treg imbalance is an important cause of immune cell infiltration into the central nervous system (CNS) and subsequent neuroinflammation, demyelination, and neurodegeneration in multiple sclerosis (MS). Increasing attention has been given to the role of the microbiota-gut-brain axis in MS pathogenesis. The gut microbiota affects the Th17/Treg balance in the gut as well as in distal areas, such as the CNS, which further contributes to the onset and progression of MS. Our previous studies have shown that Astragalus polysaccharide (APS) has a role in alleviating the clinical symptoms and demyelination of experimental autoimmune encephalomyelitis (EAE) mice, a classic MS model. However, the mechanism of action is not fully understood. In this study, we found that APS suppressed inflammation and regulated the Th17/Treg balance in the CNS and peripheral blood of EAE mice. It was further shown that APS inhibited gut inflammation and reduced Th17 function. The experiment with an antibiotic cocktail interfering with the gut microbiota proved that APS alleviated EAE by regulating the gut microbiota. Through 16S rRNA sequencing, we showed that APS regulated gut microbiota diversity and composition in EAE mice. Then, we found that APS regulated metabolite composition in feces and plasma, thus altering gut and blood metabolic functions. The neuroactive ligand?receptor interaction pathway was enriched in both fecal and plasma metabolites. Metabolites related to this pathway, including sphingosine 1 phosphate (S1P), prostaglandin E2 (PGE2), ADP, and ATP, were downregulated by APS. The levels of bile acid metabolites such as taurochenodeoxycholate-7-sulfate and N-palmitoyl aspartic acid were upregulated by APS. In summary, our study demonstrated that APS exerts a suppressive effect on EAE by regulating gut microbiota composition, affecting metabolite composition, and improving the Th17/Treg balance in the peripheral blood and CNS.