Pyroptosis is a newly identified mode of programmed cell death, but the potential role in patients with acute myocardial infarction (AMI) remains unclear. In this study, bioinformatics methods were used to identify differentially expressed genes from peripheral blood transcriptome data between normal subjects and patients with AMI which were downloaded by the Gene Expression Omnibus database. Comparing Random Forest (RF) and Support Vector Machine (SVM) training algorithms were used to identify pyroptosis-related genes, predicting patients with AMI by nomogram based on informative genes. Moreover, clustering was used to amplify the feature of pyroptosis, in order to facilitate analysis distinct biological differences. Diversity analysis indicated that a majority of pyroptosis-related genes are expressed at higher levels in patients with AMI. The receiver operating characteristic curves show that the RF model is more responsive than the SVM machine learning model to the pyroptosis characteristics of these patients in vivo. We obtained a column line graph diagnostic model which was developed based on 19 genes established by the RF model. After the consensus clustering algorithm of single sample Gene Set Enrichment Analysis and Kyoto Encyclopedia of Genes and Genomes (KEGG) Enrichment Analysis, the results for them found that pyroptosis-related genes mediate the activation of multiple immune cells and many inflammatory pathways in the body. We used RF and SVM algorithms to determine 19 pyroptosis-related genes and evaluate their immunological effects in patients with AMI. We also constructed a series of by nomogram related to pyroptosis-related genes to predict the risk of developing AMI.