The objective of this study was to investigate the microbial mechanisms for the improvement of composting efficiency after Bacillus subtilis inoculation with soluble phosphorus function in the spent mushroom substrate (SMS) aerobic composting. The methods in this study, including redundant analysis (RDA), co-occurrence network analyze and Phylogenetic Investigation of Communities by Reconstruction of Unobserved States (PICRUSt 2) were carried out studying the dynamic changes of phosphorus (P) components, microbial interactions and metabolic characteristics in the SMS aerobic composting inoculated with phosphorus-solubilizing B. subtilis (PSB). An increase in germination index (GI) (up to 88.4%), total nitrogen (TN) (16.6 g kg−1), available P content (0.34 g kg−1) and total P (TP) content (3.20 g kg−1) and a decrease in total organic carbon (TOC), C/N and electrical conductivity (EC) in final composting stage indicated B. subtilis inoculation could further improve maturity quality of the composting product compared with CK. Other results also demonstrated that PSB inoculation increased the stability of compost, humification degree and bacterial diversity, contributing to P fractions transformation in the composting process. Co-occurrence analysis suggested that PSB strengthened microbial interactions. Metabolic function of bacterial community analysis showed pathways such as carbohydrate metabolism, and amino acid metabolism in the composting were increased by effects of PSB inoculation. In summary, this study reveals a useful basis for better regulating the P nutrient level of the SMS composting and reducing environmental risks by inoculating B. subtilis with P solubilizing function.