This study aimed to investigate immune score and stromal score-related signatures associated with preeclampsia (PE) and identify key genes for diagnosing PE using bioinformatics analysis. Four microarray datasets, GSE75010, GSE25906, GSE44711, and GSE10588 were obtained from the Gene Expression Omnibus database. GSE75010 was utilized for differential expressed gene (DEGs) analysis. Subsequently, bioinformatic tools such as gene ontology, Kyoto Encyclopedia of Genes and Genomes, weighted gene correlation network analysis, and gene set enrichment analysis were employed to functionally characterize candidate target genes involved in the pathogenesis of PE. The least absolute shrinkage and selection operator regression approach was employed to identify crucial genes and develop a predictive model. This method also facilitated the creation of receiver operating characteristic (ROC) curves, enabling the evaluation of the model’s precision. Furthermore, the model underwent external validation through the other three datasets. A total of 3286 DEGs were identified between normal and PE tissues. Gene ontology and Kyoto Encyclopedia of Genes and Genomes analyses revealed enrichments in functions related to cell chemotaxis, cytokine binding, and cytokine–cytokine receptor interaction. weighted gene correlation network analysis identified 2 color modules strongly correlated with immune and stromal scores. After intersecting DEGs with immune and stromal-related genes, 13 genes were selected and added to the least absolute shrinkage and selection operator regression. Ultimately, 7 genes were screened out to establish the risk model for discriminating preeclampsia from controls, with each gene having an area under the ROC curve >0.70. The constructed risk model demonstrated that the area under the ROC curves in internal and the other three external datasets were all greater than 0.80. A 7-gene risk signature was identified to build a potential diagnostic model and performed well in the external validation group for PE patients. These findings illustrated that immune and stromal cells played essential roles in PE during its progression.