Heatstroke is a critical condition with a high mortality rate and intestinal barrier dysfunction is a key factor in its progression to sepsis in some patients. This study aimed to explore the protective effects of rifaximin on the intestinal barrier in heat-stroke mice and the underlying mechanisms. A mouse model of heat stroke was established, followed by rifaximin intervention. Rifaximin significantly improved survival rates, reduced core body temperature, and alleviated intestinal tissue damage. Further mechanistic studies revealed that rifaximin restored heat stroke-induced damage to intestinal barrier function by upregulating the expression of the tight junction proteins, ZO-1 and occludin. Additionally, 16S rRNA sequencing showed that rifaximin significantly increased the abundance of Lachnospiraceae in the gut and enhanced short-chain fatty acid butyrate levels. In vitro experiment results revealed that butyrate promotes the expression of the intestinal epithelial cell protein MUC2, thereby strengthening the intestinal barrier. Rifaximin also activated the pregnane X receptor (PXR) signaling pathway and inhibited the NF-κB/MLCK signaling pathway, reducing the permeability of intestinal epithelial cells. This study demonstrated that rifaximin protects the intestinal barrier in mice with heat stroke through multiple pathways by modulating the gut microbiota, increasing butyrate production, and activating the PXR signaling pathway. These findings provide a new theoretical basis for the clinical application of rifaximin in heat stroke treatment.