Gastrodia elata Blume was used to treat stroke and headaches caused by “Feng” for thousands of years. The present study has shown a significant effect of G. elata Blume in improving cerebral ischemia–reperfusion injury (CIRI). However, the mechanism of G. elata Blume in improving CIRI by regulating the intestinal flora has not been reported until now. This research aimed to comprehensively evaluate the mechanism of G. elata Blume in CIRI based on fecal metabolomics and 16S rDNA sequencing. The rat model with CIRI was created based on the Zea Longa method. Enzyme-linked immunosorbent assay (ELISA) was used to monitor the inflammatory factors in rat serum. Damages of brain tissues were observed using hematoxylin and eosin (H&E) staining. Cerebral infarction was observed by 2,3,5-triphenyltetrazolium chloride (TTC) staining. The balance of intestinal flora in cecal contents of rats was evaluated by high-throughput sequencing. Changes of metabolites in the intestinal flora were evaluated by fecal metabolomics through Ultra high performance liquid chromatography-orbitrap exploris-mass spectrometer (UHPLC-OE-MS). The area of brain necrosis, cerebral infarction volume, and the contents of inflammatory factors in CIRI rats can be effectively reduced after oral administration of G. elata Blume. CIRI can cause disturbances in the intestinal flora and its associated metabolites. G. elata Blume can significantly regulate the composition of the intestinal microflora. It reversed CIRI-induced changes in the levels of multiple intestinal bacteria, including Prevotellaceae, Coriobacteriaceae; Prevotella, Gamma proteobacteria unclassified, Barnesiella, Escherichia, Shigella; uncultured Shigella sp., Flavonifractor sp., Escherichia sp. enrichment culture clone NBAR004, Veillonella sp. R-32, and Lactobacillus intestinalis. The levels of metabolites in cecal contents were disturbed in rats with CIRI, including amino acid, purine, and sphingolipid metabolism. The changes in the level of biomarkers in amino acid metabolism induced by CIRI were significantly reversed after treatment with G. elata Blume. Correlation studies show that Prevotellaceae was significantly positively correlated with interleukin (IL)-6, and L. intestinalis and L-phenylalanine were negatively interrelated to IL-1β. Beta-glycerophosphoric acid was significantly negatively interrelated to high-sensitivity C-reactive protein (hs-CRP). There were significantly negative correlations between L-phenylalanine and L. intestinalis, beta-glycerophosphoric acid and Prevotellaceae. G. elata Blume protected against CIRI, which may be related to improved intestinal microflora composition and metabolism, resulting in decreased inflammation.