During colonization of soil and plants, biocontrol bacteria can effectively regulate the physiological metabolism of plants and induce disease resistance. To illustrate the influence of Bacillus subtilis R31 on the quality, transcriptome and metabolome of sweet corn, field studies were conducted at a corn experimental base in Zhuhai City. The results show that, after application of B. subtilis R31, sweet corn was more fruitful, with a 18.3 cm ear length, 5.0 cm ear diameter, 0.4 bald head, 403.9 g fresh weight of single bud, 272.0 g net weight of single ear, and 16.5 kernels sweetness. Combined transcriptomic and metabolomic analyses indicate that differentially expressed genes related to plant-pathogen interactions, MAPK signaling pathway-plant, phenylpropanoid biosynthesis, and flavonoid biosynthesis were significantly enriched. Moreover, the 110 upregulated DAMs were mainly involved in the flavonoid biosynthesis and flavone and flavonol biosynthesis pathways. Our study provides a foundation for investigating the molecular mechanisms by which biocontrol bacteria enhance crop nutrition and taste through biological means or genetic engineering at the molecular level.