Abstract Background This study aimed to identify genes related to the degree of immune cell infiltration in head and neck squamous cell carcinoma (HNSCC), explore their new biological functions, and evaluate their diagnostic and prognostic value in HNSCC. Methods Transcriptomic data from The Cancer Genome Atlas (TCGA) HNSCC dataset was used to screen differentially expressed genes between tumors and normal tissues, followed by weighted correlation network analysis (WGCNA) to identify immune‐related modules. Differential gene expression, immune cell infiltration, and survival analyses were performed to screen key genes. The expression of these key genes was validated in Oncomine and gene expression omnibus (GEO) datasets and by immunohistochemistry (IHC). Results 1869 and 1578 genes were significantly upregulated and downregulated in HNSCC. WGCNA showed that the brown module was associated with the most significant number of immune‐related genes. PPI network analysis demonstrated that PPL, SCEL, KRT4, KRT24, KRT78, KRT13, SPRR3, TGM3, CRCT1, and CRNN were key components in the brown module. Furthermore, the expression levels of KRT4, KRT78, KRT13, and SPRR3 in HNSCC correlated with infiltration levels of CD8+ T cells and macrophages. Survival analyses revealed that the expression of KRT78, KRT13, and SPRR3 in HNSCC correlated with overall survival (OS). The IHC assay indicated that KRT13 (p = .042), KRT78 (p