BackgroundLower respiratory tract infections represent prevalent ailments. Nonetheless, current comprehension of the microbial ecosystems within the lower respiratory tract remains incomplete and necessitates further comprehensive assessment. Leveraging the advancements in metagenomic next-generation sequencing (mNGS) technology alongside the emergence of machine learning, it is now viable to compare the attributes of lower respiratory tract microbial communities among patients across diverse age groups, diseases, and infection types.MethodWe collected bronchoalveolar lavage fluid samples from 138 patients diagnosed with lower respiratory tract infections and conducted mNGS to characterize the lung microbiota. Employing various machine learning algorithms, we investigated the correlation of key bacteria in patients with concurrent bronchiectasis and developed a predictive model for hospitalization duration based on these identified key bacteria.ResultWe observed variations in microbial communities across different age groups, diseases, and infection types. In the elderly group, Pseudomonas aeruginosa exhibited the highest relative abundance, followed by Corynebacterium striatum and Acinetobacter baumannii. Methylobacterium and Prevotella emerged as the dominant genera at the genus level in the younger group, while Mycobacterium tuberculosis and Haemophilus influenzae were prevalent species. Within the bronchiectasis group, dominant bacteria included Pseudomonas aeruginosa, Haemophilus influenzae, and Klebsiella pneumoniae. Significant differences in the presence of Pseudomonas phage JBD93 were noted between the bronchiectasis group and the control group. In the group with concomitant fungal infections, the most abundant genera were Acinetobacter and Pseudomonas, with Acinetobacter baumannii and Pseudomonas aeruginosa as the predominant species. Notable differences were observed in the presence of Human gammaherpesvirus 4, Human betaherpesvirus 5, Candida albicans, Aspergillus oryzae, and Aspergillus fumigatus between the group with concomitant fungal infections and the bacterial group. Machine learning algorithms were utilized to select bacteria and clinical indicators associated with hospitalization duration, confirming the excellent performance of bacteria in predicting hospitalization time.ConclusionOur study provided a comprehensive description of the microbial characteristics among patients with lower respiratory tract infections, offering insights from various perspectives. Additionally, we investigated the advanced predictive capability of microbial community features in determining the hospitalization duration of these patients.