Despite advancements in antiretroviral therapy, mild cognitive deficits persist in nearly half of people with HIV (PWH). The profile of impairment in HIV is highly variable with deficits observed in a range of cognitive domains. Despite evidence of greater cognitive impairment among women with HIV (WWH) vs. men with HIV (MWH), it is unclear how MWH and WWH differ in the type of cognitive impairment and in risk factors associated with cognitive impairment profiles. In a large and well-characterized sample of PWH, we used machine learning to identify profiles of cognitive functioning and their associated factors overall and within sex. Participants included 1,666 PWH (201 WWH; 1,465 MMH) from the HIV Neurobehavioral Research Program who completed a neuropsychological test battery at their baseline visits. Using demographically-adjusted T-scores from 13 test outcomes assessing motor skills, executive functioning, attention/working memory, episodic learning and memory, verbal fluency, and processing speed, we used Kohonen self-organizing maps to identify patterns of high-dimensional data by mapping participants to similar nodes based on T-scores (MCLUST R package). Random forest models were used to determine how sociodemographic (e.g., age, education), clinical (e.g., depressive symptoms, substance use disorder), and biological (e.g., HIV disease characteristics) factors differentially related to membership within a cognitive profile. All analyses were repeated within sex. Three cognitive profiles were identified overall and within each sex. Overall and within MWH, there were unimpaired and global weakness profiles. The third profile in the total sample demonstrated relatively weak auditory attention whereas in MWH showed relative strengths in attention and processing speed. Conversely, there was no unimpaired profile among WWH. Rather, WWH demonstrated separate profiles reflecting weakness in motor skills, a relative weakness in learning and delayed recall, and global weaknesses with spared recognition memory. Despite different cognitive profiles by sex, the most discriminative factors were similar between men and women and included reading level (cognitive reserve), current and nadir CD4 count, plasma HIV viral load, duration of HIV disease, age, depressive symptoms, and race/ethnicity. Findings fill a knowledge gap concerning sex differences in cognitive impairment in PWH and inform personalized risk reduction and therapeutic strategies.