Objective. This study is aimed at integrating bioinformatics and machine learning to determine novel diagnostic gene signals in the progression of heart failure disease. Methods. The heart failure microarray datasets and RNA-seq datasets have been downloaded from the public database. Differentially expressed genes (DE genes) are screened out, and then, we analyze their biological functions and pathways. Integrating three machine learning methods, the least absolute shrinkage and selection operator (LASSO) algorithm, random forest (RF) algorithm, and support vector machine recursive feature elimination (SVM-RFE) are used to determine candidate diagnostic gene signals. Then, external independent RNA-seq datasets evaluate the diagnostic value of gene signals. Finally, the convolution tool CIBERSORT estimated the composition pattern of immune cell subtypes in heart failure and carried out a correlation analysis combined with gene signals. Results. Under the set threshold, we obtained 47 DE genes with the most significant differences. Enrichment analysis shows that most of them are related to hypertrophy, matrix structural constituent, protein binding, inflammatory immune pathway, cardiovascular disease, and inflammatory disease. Three machine learning methods assisted in determining the potential characteristic signals Fras1-related extracellular matrix 1 (FREM1) and meiosis-specific nuclear structural 1 (MNS1). Validation of external datasets confirms that FREM1 is a diagnostic gene signal for heart failure. Immune cell subtypes of tissue specimens found T cell CD8, mast cell resting, T cell CD4 memory resting, T cell regulation (Tregs), monocytes, macrophages M2, T cell CD4 naive, macrophages M0, and neutrophils are associated with HF. Conclusion. The gene signal FREM1 may be a potential molecular target in the development of HF and is related to the difference in immune infiltration of HF tissue.