Parkinson's disease is the second most common neurodegenerative disease in the world. However, current diagnostic methods are still limited, and available treatments can only mitigate the symptoms of the disease, not reverse it at the root. The immune function has been identified as playing a role in PD, but the exact mechanism is unknown. This study aimed to search for potential immune-related hub genes in Parkinson's disease, find relevant immune infiltration patterns, and develop a categorical diagnostic model. We downloaded the GSE8397 dataset from the GEO database, which contains gene expression microarray data for 15 healthy human SN samples and 24 PD patient SN samples. Screening for PD-related DEGs using WGCNA and differential expression analysis. These PD-related DEGs were analyzed for GO and KEGG enrichment. Subsequently, hub genes (dld, dlk1, iars and ttd19) were screened by LASSO and mSVM-RFE machine learning algorithms. We used the ssGSEA algorithm to calculate and evaluate the differences in nigrostriatal immune cell types in the GSE8397 dataset. The association between dld, dlk1, iars and ttc19 and 28 immune cells was investigated. Using the GSEA and GSVA algorithms, we analyzed the biological functions associated with immune-related hub genes. Establishment of a ceRNA regulatory network for immune-related hub genes. Finally, a logistic regression model was used to develop a PD classification diagnostic model, and the accuracy of the model was verified in three independent data sets. The three independent datasets are GES49036 (containing 8 healthy human nigrostriatal tissue samples and 15 PD patient nigrostriatal tissue samples), GSE20292 (containing 18 healthy human nigrostriatal tissue samples and 11 PD patient nigrostriatal tissue samples) and GSE7621 (containing 9 healthy human nigrostriatal tissue samples and 16 PD patient nigrostriatal tissue samples). Ultimately, we screened for four immune-related Parkinson's disease hub genes. Among them, the AUC values of dlk1, dld and ttc19 in GSE8397 and three other independent external datasets were all greater than 0.7, indicating that these three genes have a certain level of accuracy. The iars gene had an AUC value greater than 0.7 in GES8397 and one independent external data while the AUC values in the other two independent external data sets ranged between 0.5 and 0.7. These results suggest that iars also has some research value. We successfully constructed a categorical diagnostic model based on these four immune-related Parkinson's disease hub genes, and the AUC values of the joint diagnostic model were greater than 0.9 in both GSE8397 and three independent external datasets. These results indicate that the categorical diagnostic model has a good ability to distinguish between healthy individuals and Parkinson's disease patients. In addition, ceRNA networks reveal complex regulatory relationships based on immune-related hub genes. In this study, four immune-related PD hub genes (dld, dlk1, iars and ttd19) were obtained. A reliable diagnostic model for PD classification was developed. This study provides algorithmic-level support to explore the immune-related mechanisms of PD and the prediction of immune-related drug targets.