BackgroundTuberculosis (TB) is an infectious disease caused by Mycobacterium tuberculosis (Mtb) infection. Cuproptosis is a novel cell death mechanism correlated with various diseases. This study sought to elucidate the role of cuproptosis-related genes (CRGs) in TB.MethodsBased on the GSE83456 dataset, we analyzed the expression profiles of CRGs and immune cell infiltration in TB. Based on CRGs, the molecular clusters and related immune cell infiltration were explored using 92 TB samples. The Weighted Gene Co-expression Network Analysis (WGCNA) algorithm was utilized to identify the co-expression modules and cluster-specific differentially expressed genes. Subsequently, the optimal machine learning model was determined by comparing the performance of the random forest (RF), support vector machine (SVM), generalized linear model (GLM), and eXtreme Gradient Boosting (XGB). The predictive performance of the machine learning model was assessed by generating calibration curves and decision curve analysis and validated in an external dataset.Results11 CRGs were identified as differentially expressed cuproptosis genes. Significant differences in immune cells were observed in TB patients. Two cuproptosis-related molecular clusters expressed genes were identified. Distinct clusters were identified based on the differential expression of CRGs and immune cells. Besides, significant differences in biological functions and pathway activities were observed between the two clusters. A nomogram was generated to facilitate clinical implementation. Next, calibration curves were generated, and decision curve analysis was conducted to validate the accuracy of our model in predicting TB subtypes. XGB machine learning model yielded the best performance in distinguishing TB patients with different clusters. The top five genes from the XGB model were selected as predictor genes. The XGB model exhibited satisfactory performance during validation in an external dataset. Further analysis revealed that these five model-related genes were significantly associated with latent and active TB.ConclusionOur study provided hitherto undocumented evidence of the relationship between cuproptosis and TB and established an optimal machine learning model to evaluate the TB subtypes and latent and active TB patients.