Background: In contrast to identification of well-defined oncogenic alterations like BRAF mutations for malignant melanoma (MM) patient stratification, effective selection of predictive biomarkers remains a challenge in the era of checkpoint blockade.Methods: The differentially expressed genes (DEGs) related to the TME were identified using The Cancer Genome Atlas (TCGA) dataset by Wilcoxon rank sum test. The prognostic effects of immune-related genes (IRGs) were analyzed using univariate Cox regression. Next, the prognostic model was constructed by step multivariate Cox regression and risk score of each sample was calculated. Then, survival and Receiver Operating Characteristic (ROC) analyses were conducted to validate the model using TCGA and the Gene Expression Omnibus (GEO) datasets, respectively. Finally, the overall immune status, tumor purity of high- and low-risk groups was further analyzed to reveal the potential mechanisms of prognostic effects of the model.Results: Twenty eight IRGs were identified, the univariate cox analysis indicated the hazard ratio ranged from 0.796 to 2.621 (p-value < 0.05). 6 genes (SLPI, S100A7, LYZ, CCL19, CXCR4 and CD79A) were screened out by step multivariate cox regression and a 6-IRGs, which can be used as an independent prognostic factor, was constructed. The MM patients in both training (TCGA) and testing (GEO) datasets can be well stratified as high-risk and low-risk groups with the 6-IRGs signature, and the 3-year and 5-year area under curve (AUC) of ROC curves of GEO set were 0.681 and 0.678 (GSE19234). Conclusions: In sum, we identified and constructed a 6-IRGs , which can be used to predict the prognosis of metastasis in MM patients.