Anxiety is frequently observed in patients with systemic lupus erythematosus (SLE) and the immune system could act as a trigger for anxiety. To recognize abnormal T-cell and B-cell subsets for SLE patients with anxiety, in this study, patient disease phenotypes data from electronic lupus symptom records were extracted by using natural language processing. The Hospital Anxiety and Depression Scale (HADS) was used to distinguish patients, and 107 patients were selected to meet research requirements. Then, peripheral blood was collected from two patient groups for multicolor flow cytometry experiments. The characteristics of 75 T-cell and 15 B-cell subsets were investigated between SLE patients with- (n = 23) and without-anxiety (n = 84) groups by four machine learning methods. The findings showed 13 T-cell subsets were significantly different between the two groups. Furthermore, BMI, fatigue, depression, unstable emotions, CD27+CD28+ Th/Treg, CD27−CD28− Th/Treg, CD45RA−CD27− Th, and CD45RA+HLADR+ Th cells may be important characteristics between SLE patients with- and without-anxiety groups. The findings not only point out the difference of T-cell subsets in SLE patients with or without anxiety, but also imply that T cells might play the important role in patients with anxiety disorder.