The primary risk factor for infection with members of the Klebsiella pneumoniae species complex is prior gut colonization, and infection is often caused by the colonizing strain. Despite the importance of the gut as a reservoir for infectious K. pneumoniae, little is known about the association between the gut microbiome and infection. To explore this relationship, we undertook a case-control study comparing the gut community structure of K. pneumoniae-colonized intensive care and hematology/oncology patients. Cases were K. pneumoniae-colonized patients infected by their colonizing strain (N = 83). Controls were K. pneumoniae-colonized patients who remained asymptomatic (N = 149). First, we characterized the gut community structure of K. pneumoniae-colonized patients agnostic to case status. Next, we determined that gut community data is useful for classifying cases and controls using machine learning models and that the gut community structure differed between cases and controls. K. pneumoniae relative abundance, a known risk factor for infection, had the greatest feature importance, but other gut microbes were also informative. Finally, we show that integration of gut community structure with bacterial genotype data enhanced the ability of machine learning models to discriminate cases and controls. Interestingly, inclusion of patient clinical variables failed to improve the ability of machine learning models to discriminate cases and controls. This study demonstrates that including gut community data with K. pneumoniae-derived biomarkers improves our ability to classify infection in K. pneumoniae-colonized patients.IMPORTANCEColonization is generally the first step in pathogenesis for bacteria with pathogenic potential. This step provides a unique window for intervention since a given potential pathogen has yet to cause damage to its host. Moreover, intervention during the colonization stage may help alleviate the burden of therapy failure as antimicrobial resistance rises. Yet, to understand the therapeutic potential of interventions that target colonization, we must first understand the biology of colonization and if biomarkers at the colonization stage can be used to stratify infection risk. The bacterial genus Klebsiella includes many species with varying degrees of pathogenic potential. Members of the K. pneumoniae species complex have the highest pathogenic potential. Patients colonized in their gut by these bacteria are at higher risk of subsequent infection with their colonizing strain. However, we do not understand if other members of the gut microbiota can be used as a biomarker to predict infection risk. In this study, we show that the gut microbiota differs between colonized patients who develop an infection versus those who do not. Additionally, we show that integrating gut microbiota data with bacterial factors improves the ability to classify infections. Surprisingly, patient clinical factors were not useful for classifying infections alone or when added to microbiota-based models. This indicates that the bacterial genotype and the microbial community in which it exists may determine the progression to infection. As we continue to explore colonization as an intervention point to prevent infections in individuals colonized by potential pathogens, we must develop effective means for predicting and stratifying infection risk.