Background: This study aimed to identify potential diagnostic markers of ischemic stroke (IS) and discuss the function of immune cell infiltration during the pathological process. Methods: We used IS datasets from the Gene Expression Omnibus database. Differentially expressed genes (DEGs) were identified, and functional correlation analysis was performed. We then screened and verified the diagnostic markers of IS. We evaluated the infiltration of immune cells in infarcts using CIBERSORT and analyzed the correlation between diagnostic markers and infiltrating immune cells. Results: A total of 366 DEGs were screened in this study. Genes encoding CTSG, F13A1, PABPC1, ECHDC2, BIRC2 and infiltrating monocytes, M0 macrophages, activated dendritic cells, and neutrophils (area under the curve [AUC] = 0.945) were identified as diagnostic markers of IS. Immune cell infiltration analysis suggested that memory B cells, regulatory T cells, M0 macrophages, CD8 + T cells, γδT cells, activated natural killer cells, monocytes, activated mast cells, and neutrophils were involved in the IS process. Analysis of correlations between expressed genes and infiltrating immune cells found that CTSG was positively associated with M0 macrophages, F13A1 was positively associated with monocytes, PABPC1 was positively associated with activated dendritic cells, eosinophils were negatively associated with neutrophils, ECHDC2 was negatively associated with monocytes, and BIRC2 was positively associated with eosinophils. Conclusion: five genes and four types of immune cells were identified as diagnostic markers of IS, and immune cell infiltration may play an important role in the progression of IS.