Methods and resultsIn this study, an effective endophytic B. subtilis A9 for the control of M. esculenta rot disease was screened, and its biocontrol mechanism was studied by transcriptome analysis. In total, 122 strains of endophytic bacteria from M. esculenta, of which the antagonistic effect of Bacillus subtilis A9 on L. aphanocladii G1 reached 72.2% in vitro tests. Biological characteristics and genomic features of B. subtilis A9 were analyzed, and key antibiotic gene clusters were detected. Scanning electron microscope (SEM) observation showed that B. subtilis A9 affected the mycelium and spores of L. aphanocladii G1. In field experiments, the biological control effect of B. subtilis A9 reached to 62.5%. Furthermore, the transcritome profiling provides evidence of B. subtilis A9 bicontrol at the molecular level. A total of 1,246 differentially expressed genes (DEGs) were identified between the treatment and control group. Gene Ontology (GO) enrichment analysis showed that a large number of DEGs were related to antioxidant activity related. Kyoto Encyclopedia of Genes and Genomes (KEGG) enrichment analysis showed that the main pathways were Nitrogen metabolism, Pentose Phosphate Pathway (PPP) and Mitogen-Activated Protein Kinases (MAPK) signal pathway. Among them, some important genes such as carbonic anhydrase CA (H6S33_007248), catalase CAT (H6S33_001409), tRNA dihydrouridine synthase DusB (H6S33_001297) and NAD(P)-binding protein NAD(P) BP (H6S33_000823) were found. Furthermore, B. subtilis A9 considerably enhanced the M. esculenta activity of Polyphenol oxidase (POD), Superoxide dismutase (SOD), Phenylal anineammonia lyase (PAL) and Catalase (CAT).