The gut microbiota is important in metabolism and immune modulation, and compositional disruption of the gut microbiota population is closely associated with inflammation caused by ionizing radiation (IR). Guiqi Baizhu decoction (GQBZD) is a medicinal compound used in traditional Chinese medicine with anti-inflammatory and antioxidation effects, especially in the process of radiotherapy. However, the effect of GQBZD on reducing the damage to the normal immune system in radiotherapy remains unclear. Here, we show that GQBZD reduces body weights, water intake, food intake, diarrhea level and quality of life score, and inflammation and enhances immunity function in rats treated with X-ray radiation. Meanwhile, our data indicate that GQBZD not only reverses IR-induced gut dysbiosis as indicated change of α-diversity and β-diversity of microbiota, the composition of Desulfovibrio, Bacteroides, and Parabacteroides, except for Roseburia and Lachnoclostridium, but also maintains intestinal barrier integrity and promoting the formation of short-chain fatty acids (SCFAs). GQBZD can also reduce the level of phosphorylation P65 (p-P65). Our results demonstrate that GQBZD can significantly alleviate the inflammatory responses and improve the immune damage against IR, and may be used as prebiotic agents to prevent gut dysbiosis and radiation-related metabolic disorders in radiotherapy.