Only 30–40% of advanced melanoma patients respond effectively to immunotherapy in clinical practice, so it’s necessary to accurately identify the response of melanoma patients to immune therapy pre-clinically. Here we developed the KP-NET, a deep learning model whose structure is sparse by the KEGG pathways, which can accurately predict melanoma patients’ response to immunotherapy using information at the pathway level that is enriched from gene mutations and copy number variations data prior to immune therapy. The KP-NET demonstrated the best performance on predictive melanoma response to anti-CTLA-4 and anti-PD-1 treatment with corresponding AUROC values of 0.889 and 0.867, and selected some relevant biomarkers, genes such as PLCB2, FGFR4, RHEB and CCNB2, pathways such as Inflammatory mediator regulation of TRP channels, Notch signaling pathway, mTOR signaling pathway and TNF signaling pathway, etc. In conclusion, deep learning model guided by biological information enables accurate prediction of the response of melanoma patients to immunotherapy and relevant biomarkers before clinical treatment, which may be helpful in melanoma precision medicine.