Abstract Study question Can artificial intelligence (AI) algorithm identify CD138+ cells in the endometrial stroma, and is the expression altered in PCOS and RIF? Summary answer CD138+ cell detection by AI shows high accuracy. The cell count in controls was comparable to that in PCOS cases but differed in RIF patients. What is known already Immunohistochemical (IHC) staining for CD138+ plasma cells has been applied to detect endometrial inflammation; however, due to a lack of cost-effective and reliable tools, there is no golden standard for CD138+ analysis. PCOS is a common endocrine disorder characterized by irregular menstrual cycles and hyperandrogenism. The women are also affected by systemic low-grade inflammation, and the PCOS endometrium shows dysregulated immune profile. RIF is one of the main causes of a low IVF success rate, and chronic endometrial inflammation has been detected in women with RIF. To date, AI technology has been applied in the diagnostics of various clinical conditions. Study design, size, duration In this study, AI analysis was done for CD138+ cells in a total of 193 endometrial biopsy samples: 73 were obtained from healthy and fertile controls, 91 from women with PCOS (ovulatory samples; n = 78, anovulatory samples; n = 13, Rotterdam criteria), and 29 samples from RIF patients on day five after the initiation of P4 administration. Participants/materials, setting, methods The biopsy samples were collected by suction curette (Pipelle), and endometrial receptivity was assessed by gene expression profiling (beREADY test). The tissues were stained with CD138 antibody, and the AI algorithm, AITAH, was trained with 150 whole slide images (WSIs) to segment epithelium and stroma and segregate CD138- and CD138+ cells in the stroma. AITAH was validated by three external pathologists. The cell counts were compared according to cycle phases, ovulatory status, and endometrial receptivity. Main results and the role of chance The performance of AITHA was excellent, as the final training error for CD138+ cells was 3.23%, and the decisions for the cells between pathologists and AITAH were in complete agreement. The CD138+ cell percentages were higher in the proliferative phase (PE) endometrial tissue than in the ones obtained in the secretory phase (PCOS, p <0.001 or control, p <0.001), regardless of PCOS diagnosis. Similar CD138+ cell percentages were observed between PE endometrium and anovulatory endometrium in PCOS cases (p <0.001). The count of CD138+ plasma cells was negatively correlated with the endometrial thickness (PCOS, p =0.001 or control, p =0.009) and P4 (PCOS, p =0.001 or control, p =0.003), and positive correlations between the cell counts and gonadotropin levels were observed in ovulatory PCOS samples (FSH, p =0.001 and LH, p =0.031). More CD138+ cells were seen in RIF patients compared to the controls at the receptive stage (p = 0.046); however, there was no difference between RIF samples of three different receptivity statuses (p =0.426). Limitations, reasons for caution Further validation for AITAH using confirmed chronic endometritis cases as positive controls is required. And further analysis using control samples obtained during the hormone replacement treatment is required. The small number of anovulatory PCOS subjects may explain the absence of correlations between the CD138+ plasma cell counts and clinical characteristics. Wider implications of the findings AI-enabled analysis tools could improve histological examination of endometrial immune cells by analyzing high amounts of whole tissue slides within a short time with a high pixel resolution, thus overcoming many current impediments in manual microscopic evaluation. Trial registration number NA