The present study was designed to identify potential diagnostic markers for acute myocardial infarction (AMI) and determine the significance of immune cell infiltration in this pathology. Methods: Two publicly available gene expression profiles (GSE66360 and GSE48060 datasets) from human AMI and control samples were downloaded from the GEO database. Differentially expressed genes (DEGs) were screened between 80 AMI and 71 control samples. The LASSO regression model and support vector machine recursive feature elimination (SVM-RFE) analysis were performed to identify candidate biomarkers. The area under the receiver operating characteristic curve (AUC) value was obtained and used to evaluate discriminatory ability. The expression level and diagnostic value of the biomarkers in AMI were further validated in the GSE60993 dataset (17 AMI patients and 7 controls). The compositional patterns of the 22 types of immune cell fraction in AMI were estimated based on the merged cohorts using CIBERSORT. Results: A total of 27 genes were identified. The identified DEGs were mainly involved in carbohydrate binding, Kawasaki disease, atherosclerosis, and arteriosclerotic cardiovascular disease. Gene sets related to atherosclerosis signaling, primary immunodeficiency, IL-17, and TNF signaling pathways were differentially activated in AMI compared with the control. IL1R2, IRAK3, and THBD were identified as diagnostic markers of AMI (AUC = 0.877) and validated in the GSE60993 dataset (AUC = 0.941). Immune cell infiltration analysis revealed that IL1R2, IRAK3, and THBD were correlated with M2 macrophages, neutrophils, monocytes, CD4 + resting memory T cells, activated natural killer (NK) cells, and gamma delta T cells. Conclusion: IL1R2, IRAK3, and THBD can be used as diagnostic markers of AMI, and can provide new insights for future studies on the occurrence and the molecular mechanisms of AMI.