BackgroundDue to the complexity of human diets, it is difficult to relate single foods to health outcomes. We aimed to identify the dietary patterns and associated factors and to assess the association of dietary patterns with prediabetes/diabetes among adults living with and without HIV in Tanzania.MethodsDiet data were collected by a food frequency questionnaire (FFQ) and dietary patterns were derived by principal component analysis (PCA) and reduced rank regression (RRR). The associations between dietary patterns and associated factors as well as with prediabetes/diabetes were assessed using multinomial logistic regression and presented by marginal plots.ResultsOf 572 recruited, 63% were people living with HIV. The mean (±SD) age was 42.6 (±11.7) years and 60% were females. The PCA identified two major dietary patterns, i.e., vegetable-rich pattern (VRP) and vegetable-poor pattern (VPP) whereas RRR identified one dietary pattern, i.e., carbohydrate-dense pattern (CDP). In comparison to females, males had higher adherence to VPP and CDP, but less to VRP. Higher socioeconomic status was associated with higher adherence to VRP and VPP but low adherence to CDP. Compared to HIV-negative participants, people living with HIV had higher adherence to VRP but less adherence to CDP. Compared to younger people, older people had lower adherence to VPP. High adherence to CDP or VRP was positively associated with prediabetes. Higher adherence to VRP was associated with a borderline decrease in diabetes. No association was observed between VPP with either prediabetes or diabetes.ConclusionOur findings suggest that dietary patterns may impact the risk of prediabetes and diabetes differently. Awareness of the health benefits of VRP should be encouraged in the community, especially for men who seem to consume fewer vegetables. Longitudinal studies are needed to explore the contribution of dietary patterns to prediabetes/diabetes development in sub-Saharan Africa.