As a condiment with extensive nutritional value, chili is easy to be contaminated byAspergillus flavus(A. flavus) during field, transportation, and storage. This study aimed to solve the contamination of dried red chili caused byA. flavusby inhibiting the growth ofA. flavusand detoxifying aflatoxin B1(AFB1). In this study,Bacillus subtilisE11 (B. subtilis) screened from 63 candidate antagonistic bacteria exhibited the strongest antifungal ability, which could not only inhibit 64.27% ofA. flavusbut could also remove 81.34% of AFB1at 24 h. Notably, scanning electron microscopy (SEM) showed thatB. subtilisE11 cells could resist a higher concentration of AFB1, and the fermentation supernatant ofB. subtilisE11 could deform the mycelia ofA. flavus. After 10 days of coculture withB. subtilisE11 on dried red chili inoculated withA. flavus, the mycelia ofA. flavuswere almost completely inhibited, and the yield of AFB1was significantly reduced. Our study first concentrated on the use ofB. subtilisas a biocontrol agent for dried red chili, which could not only enrich the resources of microbial strains for controllingA. flavusbut also could provide theoretical guidance to prolong the shelf life of dried red chili.