BackgroundCancer stem cells (CSCs) refer to cells with self-renewal capability in tumors. CSCs play important roles in proliferation, metastasis, recurrence, and tumor heterogeneity. This study aimed to identify immune-related gene-prognostic models based on stemness index (mRNAsi) in lung adenocarcinoma (LUAD) and lung squamous cell carcinoma (LUSC), respectively.MethodsX-tile software was used to determine the best cutoff value of survival data in LUAD and LUSC based on mRNAsi. Tumor purity and the scores of infiltrating stromal and immune cells in lung cancer tissues were predicted with ESTIMATE R package. Differentially expressed immune-related genes (DEIRGs) between higher- and lower-mRNAsi subtypes were used to construct prognostic models.ResultsmRNAsi was negatively associated with StromalScore, ImmuneScore, and ESTIMATEScore, and was positively associated with tumor purity. LUAD and LUSC samples were divided into higher- and lower-mRNAsi groups with X-title software. The distribution of immune cells was significantly different between higher- and lower-mRNAsi groups in LUAD and LUSC. DEIRGs between those two groups in LUAD and LUSC were enriched in multiple cancer- or immune-related pathways. The network between transcriptional factors (TFs) and DEIRGs revealed potential mechanisms of DEIRGs in LUAD and LUSC. The eight-gene-signature prognostic model (ANGPTL5, CD1B, CD1E, CNTFR, CTSG, EDN3, IL12B, and IL2)-based high- and low-risk groups were significantly related to overall survival (OS), tumor microenvironment (TME) immune cells, and clinical characteristics in LUAD. The five-gene-signature prognostic model (CCL1, KLRC3, KLRC4, CCL23, and KLRC1)-based high- and low-risk groups were significantly related to OS, TME immune cells, and clinical characteristics in LUSC. These two prognostic models were tested as good ones with principal components analysis (PCA) and univariate and multivariate analyses. Tumor T stage, pathological stage, or metastasis status were significantly correlated with DEIRGs contained in prognostic models of LUAD and LUSC.ConclusionCancer stemness was not only an important biological process in cancer progression but also might affect TME immune cell infiltration in LUAD and LUSC. The mRNAsi-related immune genes could be potential biomarkers of LUAD and LUSC. Evaluation of integrative characterization of multiple immune-related genes and pathways could help to understand the association between cancer stemness and tumor microenvironment in lung cancer.