Objective: To explore immune-related feature genes in patients with dilated cardiomyopathy (DCM).Methods: Expression profiles from three datasets (GSE1145, GSE21610 and GSE21819) of human cardiac tissues of DCM and healthy controls were downloaded from the GEO database. After data preprocessing, differentially expressed genes (DEGs) were identified by the ‘limma’ package in R software. Gene Ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) pathway enrichment analyses were then performed to identify biological functions of the DEGs. The compositional patterns of stromal and immune cells were estimated using xCell. Hub genes and functional modules were identified based on protein-protein interaction (PPI) network analysis by STRING webtool and Cytoscape application. Correlation analysis was performed between immune cell subtypes and hub genes. Hub genes with |correlation coefficient| > 0.5 and p value <0.05 were selected as feature biomarkers. A logistic regression model was constructed based on the selected biomarkers and validated in datasets GSE5406 and GSE57338.Results: A total of 1,005 DEGs were identified. Functional enrichment analyses indicated that extracellular matrix remodeling and immune and inflammation disorder played important roles in the pathogenesis of DCM. Immune cells, including CD8+ T-cells, macrophages M1 and Th1 cells, were proved to be significantly changed in DCM patients by immune cell infiltration analysis. In the PPI network analysis, STAT3, IL6, CCL2, PIK3R1, ESR1, CCL5, IL17A, TLR2, BUB1B and MYC were identified as hub genes, among which CCL2, CCL5 and TLR2 were further screened as feature biomarkers by using hub genes and immune cells correlation analysis. A diagnosis model was successfully constructed by using the three biomarkers with area under the curve (AUC) scores 0.981, 0.867 and 0.946 in merged dataset, GSE5406 and GSE57338, respectively.Conclusion: The present study identified three immune-related genes as diagnostic biomarkers for DCM, providing a novel perspective of immune and inflammatory response for the exploration of DCM molecular mechanisms.