Based on our results, male sex, lung cancer, melanoma, and treatment with anti-PD-1, anti-PD-L1, or anti-PD-1 in combination with CTLA-4 may increase the risk of ICI-associated myocarditis. Here, CD274 is linked to lung carcinoma.