The effects of dimethyl fumarate (DMF) on mycotoxins and animal growth performance are well documented. However, its mechanism of anti-mildew effects is still unknown. The current study investigated how DMF detoxified the mycotoxin and improved the growth performance using BALB/c mice model, especially its effects on intestinal barrier function and gut micro-ecology. Our study also compared with the ultraviolet radiation (UR) treatment, a traditional anti-mildew control (TC). The results indicated that the DMF treatment had a lower contents of mycotoxin, better growth performance and improved mucosal morphology (P < 0.05), accompanied with the decreased intestinal permeability and the tighter gut barrier. Moreover, the efficiency of DMF was better than TC (P < 0.05). 16S rRNA gene sequence analysis revealed that the richness and diversity of bacteria was increased in DMF treatment. The most abundant OTUs belonged to Firmicutes and Bacteroidetes, and their changes in DMF were more moderate than the TC group, suggesting a more stable micro-ecology and the positive impact of DMF on the biodiversity of intestine. Specifically, the increased abundance of bacteria producing short-chain fatty acids (SCFAs), such as Gemella, Roseburia, Bacillus and Bacteroides in DMF group and prebiotics such as Lactobacillus in TC group, suggested a more healthier microbial composition and distribution. These findings supported that DMF had significant effects on animal's growth performance and intestinal barrier function by modulating the pathway of nutrient absorption and increasing the diversity and balance of gut microbes, which also illuminate that DMF is more efficient than traditional anti-mildew method.