Heat stress (HS) has been revealed to damage the antioxidant system and intestinal barrier function, which greatly threatens poultry production. The present study investigated the effects of dietary ellagic acid (EA) on the antioxidant system, gut barrier function, and gut microbiota of heat-stressed broilers. Arbor Acres 14-day-old broilers numbering 360 were randomly divided into six groups, including one negative control group (NC) and five experimental groups. The broilers in the NC group were supplemented with a basal diet at a normal temperature (23 ± 2 °C). The broilers in the experimental groups were supplemented with basal diets containing EA at different doses (0, 75, 150, 300, and 600 mg/kg) at HS temperature (35 ± 2 °C). The experiment lasted for 4 weeks. Results showed that dietary EA reduced the corticosterone (CORT), LPS, and diamine oxidase (DAO) levels in the serum of heat-stressed broilers. Additionally, dietary EA improved the antioxidant enzyme activity and mRNA levels of Nrf2/HO-1 in the ileum of heat-stressed broilers. The relative abundances of Streptococcus, Ruminococcus_torques, Rothia, Neisseria, Actinomyces, and Lautropia in the cecum were significantly reduced by the EA supplementation in a dose-dependent manner. Notably, the LPS, DAO, and MDA in the serum were revealed to be positively correlated with the relative abundances of Rothia, Neisseria, Actinomyces, and Lautropia, while the GSH-px, SOD, and CAT levels in the serum were negatively correlated with the relative abundances of Ruminococcus_torques, Rothia, Neisseria, Actinomyces, Streptococcus, and Lautropia. Taken together, dietary EA improved the antioxidant capacity, intestinal barrier function, and alleviated heat-stressed injuries probably via regulating gut microbiota.