ObjectiveEnergy metabolism plays a crucial role in the improvement of heart dysfunction as well as the development of heart failure (HF). The current study is designed to identify energy metabolism-related diagnostic biomarkers for predicting the risk of HF due to myocardial infarction.MethodsTranscriptome sequencing data of HF patients and non-heart failure (NF) people (GSE66360 and GSE59867) were obtained from gene expression omnibus (GEO) database. Energy metabolism-related differentially expressed genes (DEGs) were screened between HF and NF samples. The subtyping consistency analysis was performed to enable the samples to be grouped. The immune infiltration level among subtypes was assessed by single sample gene set enrichment analysis (ssGSEA). Random forest algorithm (RF) and support vector machine (SVM) were applied to identify diagnostic biomarkers, and the receiver operating characteristic curves (ROC) was plotted to validate the accuracy. Predictive nomogram was constructed and validated based on the result of the RF. Drug screening and gene-miRNA network were analyzed to predict the energy metabolism-related drugs and potential molecular mechanism.ResultsA total of 22 energy metabolism-related DEGs were identified between HF and NF patients. The clustering analysis showed that HF patients could be classified into two subtypes based on the energy metabolism-related genes, and functional analyses demonstrated that the identified DEGs among two clusters were mainly involved in immune response regulating signaling pathway and lipid and atherosclerosis. ssGSEA analysis revealed that there were significant differences in the infiltration levels of immune cells between two subtypes of HF patients. Random-forest and support vector machine algorithm eventually identified ten diagnostic markers (MEF2D, RXRA, PPARA, FOXO1, PPARD, PPP3CB, MAPK14, CREB1, MEF2A, PRMT1) for risk prediction of HF patients, and the proposed nomogram resulted in good predictive performance (GSE66360, AUC = 0.91; GSE59867, AUC = 0.84) and the clinical usefulness in HF patients. More importantly, 10 drugs and 15 miRNA were predicted as drug target and hub miRNA that associated with energy metabolism-related genes, providing further information on clinical HF treatment.ConclusionThis study identified ten energy metabolism-related diagnostic markers using random forest algorithm, which may help optimize risk stratification and clinical treatment in HF patients.