Dilated cardiomyopathy (DCM) is characterized by the left ventricular dilatation and impaired myocardial systolic dysfunction with high mortality and morbidity. However, the underlying mechanisms remain elusive. We first identified the differentially expressed genes (DEGs) between the DCM and control group using two expression profiles from GSE3585 and GSE84796. Enrichment analysis was conducted to explore the potential mechanisms underlying DCM. A total of four algorithms, including key module of MCODE, degree, maximum neighborhood component (MNC), and maximal clique centrality (MCC), were used to identify the hub genes within Cytoscape. The correlation between hub genes and infiltrated immune cells was evaluated to determine potential immune-related genes. The expression analysis and diagnosis value analysis of potential immune-related genes were performed. Finally, the expression analysis with GSE57338 and relationship analysis with the comparative toxicogenomics database (CTD) were performed to identify the key immune-related genes in DCM. A total of 80 DEGs were screened for DCM. Enrichment analysis revealed that DEGs were involved in the immune-related pathological process. Immune infiltration analysis indicated a potentially abnormal immune response in DCM. Four up-regulated genes (COL1A2, COL3A1, CD53, and POSTN) were identified as potential immune-related genes. Finally, three genes (COL1A2, COL3A1, and POSTN) were determined as the key immune-related genes in DCM via expression analysis with a validation set (GSE57338) and relationship analysis with CTD. Our study suggested that the upregulated COL1A2, COL3A1, and POSTN might be the key immune-related genes for DCM. Further studies are needed to validate the underlying mechanisms.