Coronavirus Disease 2019 (COVID-19) and sepsis are closely related. This study aims to identify pivotal diagnostic candidate genes in COVID-19 patients with sepsis. We obtained a COVID-19 data set and a sepsis data set from the Gene Expression Omnibus (GEO) database. Identification of differentially expressed genes (DEGs) and module genes using the Linear Models for Microarray Data (LIMMA) and weighted gene co-expression network analysis (WGCNA), functional enrichment analysis, protein-protein interaction (PPI) network construction, and machine learning algorithms (least absolute shrinkage and selection operator (LASSO) regression and Random Forest (RF)) were used to identify candidate hub genes for the diagnosis of COVID-19 patients with sepsis. Receiver operating characteristic (ROC) curves were developed to assess the diagnostic value. Finally, the data set GSE28750 was used to verify the core genes and analyze the immune infiltration. The COVID-19 data set contained 3,438 DEGs, and 595 common genes were screened in sepsis. sepsis DEGs were mainly enriched in immune regulation. The intersection of DEGs for COVID-19 and core genes for sepsis was 329, which were also mainly enriched in the immune system. After developing the PPI network, 17 node genes were filtered and thirteen candidate hub genes were selected for diagnostic value evaluation using machine learning. All thirteen candidate hub genes have diagnostic value, and 8 genes with an Area Under the Curve (AUC) greater than 0.9 were selected as diagnostic genes. Five core genes (CD3D, IL2RB, KLRC, CD5, and HLA-DQA1) associated with immune infiltration were identified to evaluate their diagnostic utility COVID-19 patients with sepsis. This finding contributes to the identification of potential peripheral blood diagnostic candidate genes for COVID-19 patients with sepsis.