A healthy diet includes a variety of nutritious foods, and dietary diversity, defined as the consumption of a sufficient variety of nutritious food groups, is an important indicator of nutritional adequacy and is associated with reduced risk of noncommunicable diseases (1). However, definitions and measurement of diversity vary, with most approaches using simple counts (2). This study proposes capturing both the number of food groups consumed (coverage) and the distribution of intake across these groups (evenness) by examining diversity at eating occasions (EOs), where contextual factors may influence dietary choices (3). Furthermore, this study aims to use machine learning (ML) models to predict dietary diversity at EOs. Data from the Measuring Eating in Everyday Life Study, a cross-sectional study of young adults (n = 675, 18-30 years), were analysed. Dietary intake was recorded over 3-4 non-consecutive days via a mobile app. Foods were classified into the five Australian Dietary Guidelines (ADG) food groups. An EO was defined as all foods and drinks starting within 15 minutes and totalling at least 210 kJ. Between-food group diversity score for each EO was calculated using the Shannon index. Vegetable variety (within-group diversity) was also assessed. K-means clustering partitioned EOs into diverse or less diverse groups. Person- and EO-level contextual factors were compared using Welch’s t-tests and chi-squared tests. Gradient boosting (GBM) and random forest (RF) ML models predicted EO diversity, with model performance and variable importance assessed using Local Interpretable Model-agnostic Explanations (LIME). Results showed that participants meeting physical activity guidelines and reporting greater social support from friends were more likely to have higher dietary diversity at EO (p = 0.0017 and p = 0.0038, respectively). Eating alone was more common during less diverse EOs, whereas EOs with family, friends, or others were more diverse (p < 0.0001). Diverse EOs also occurred more often at cafés/restaurants and while visiting family or friends (p < 0.0001), whereas less diverse EOs were more common at work, university, or in transit. RF outperformed GBM in predicting both between-food group diversity (accuracy: 0.83 vs. 0.64) and vegetable variety (accuracy: 0.81 vs. 0.68). Age and self-efficacy were the strongest predictors across models, with RF further highlight meal preparation and food proximity as key factors influencing dietary diversity at EOs. LIME showed that person-level factors such as income, meal preparation, physical activity, and self-efficacy had consistent but mild influence on dietary diversity across EOs. In contrast, EO-level contextual factors showed more varied and pronounced effects, with some strongly increasing dietary diversity. These findings highlight the dynamic role of contextual factors at EO in shaping dietary diversity, suggesting that interventions using ML could target EO-level factors to effectively promote diverse and nutritionally adequate diets among young adults.