BackgroundNasopharyngeal carcinoma (NPC) is one of the most prevalent cancers with a poor prognosis. Immunotherapy, especially immune checkpoint blockade (ICB), is becoming a potential therapeutic choice for NPC patients. Thus, the identification of patients who could benefit from immunotherapy is clinically significant.MethodsThe NPC expression profiles from GSE102349 were used to calculate the cell scores of the tumor microenvironment (TME). The consensus clustering method was utilized to identify the potential molecular subtypes among NPC samples. The hub genes were selected from subtype-specific genes by bioinformatics analysis. Machine learning models, including random forest (RF) and support vector machine (SVM) algorithms, were constructed to predict the immune subtype.ResultsIn the present study, we identified two TME subtypes among NPC patients. Patients with the S1 subtype have higher levels of immune cells, immune checkpoint genes, and prognosis. Using expression data profiles of NPC patients, we constructed machine learning models for predicting TME subtypes of NPC patients. This model consists of 8 genes (LCK, CD247, FYN, ZAP70, SH2D1A, CD3D, CD3E, and CD3G). Among them, LCK, FYN, SH2D1A, and CD3D were associated with better prognoses. Among the two constructed models, SVM exhibited a higher area under curve (AUC) of 0.977, when compared with RF (AUC = 0.966). The web server based on the constructed machine learning models will contribute to the identification of NPC patients likely to benefit from ICB therapies.ConclusionsThis study identified NPC subtypes and provided an accurate model to select individuals who are most likely to respond to ICB.