Urban agriculture (UA), the growing of fruits and vegetables in urban and peri-urban areas, may improve food security and access, public health and dietary quality on both a broad and personal scale. However, there is little research on the relationship between UA and diet, and potential mediating factors are also unclear. This study aimed to investigate if proximity to and engagement with UA is associated with better diet quality, and what accounts for this relationship. UK-based adults (N=583, 69% Female) completed measures of proximity to and engagement with UA, perceived access to fruits and vegetables, health and ethical food choice motivations, connection with nature, psychological distress and dietary quality in an online survey. Participants were recruited from UA-related groups and the general public. Proposed relationships were analysed using a structural equation model. Greater proximity to and engagement with UA was associated with greater perceived access to fruits and vegetables, more health-related food choice motivations, more ethical-related food choice, feeling more connected with nature, and, surprisingly greater psychological distress. Furthermore, proximity to and engagement with UA was indirectly associated with better diet quality via health-, and ethical-related, food choice motivations. While the direct pathway between proximity to and engagement with UA and diet quality was not significant, UA is associated with better diet quality, partly via healthier and ethical food choice motivations. Upscaling UA may have benefits for dietary quality via these factors, and more research is needed to test causal relationships and understand these complex interactions.