ObjectiveTo explore the causal relationship between immune cells and heart failure (HF), and the mediating role of serum metabolites, in order to identify potential biomarkers and therapeutic targets. MethodsWe employed a two-sample Mendelian randomization (MR) analysis method based on genome-wide association study (GWAS) data, analyzing the direct and indirect effects of 731 types of immune cells and 1 400 metabolites on HF. We selected valid instrumental variables and conducted statistical analyses using R software. The primary analysis was performed using the inverse variance weighted method, supplemented by MR-Egger analysis and weighted median method. The stability of the results was assessed through tests such as Cochran’s Q. ResultsOur research found a negative causal relationship between PD-L1 on CD14−CD16+ and HF. Sensitivity analysis supported this result. The reverse MR analysis did not find an effect of HF on PD-L1 on CD14−CD16+, indicating that PD-L1 on CD14−CD16+ may play a unidirectional role in reducing the risk of HF. Further mediation MR analysis showed that PD-L1 on CD14−CD16+ might influence the risk of HF onset by regulating the levels of sphingomyelin (d17:1/14:0, d16:1/15:0), with a mediation effect ratio of 6.7%. ConclusionPD-L1 on CD14−CD16+ might reduce the risk of HF by elevating the levels of sphingomyelin (d17:1/14:0, d16:1/15:0), providing a new perspective for understanding the pathogenesis of HF.