This study assesses the health risk associated with heavy metal contamination in 13 commonly consumed cereal-based products (11 pasta brands, Ash-Novin pasta, and wheat germ powder) from Arak, Iran. Concentrations of arsenic (As), cadmium (Cd), mercury (Hg), lead (Pb), and copper (Cu) were measured using inductively coupled plasma atomic emission spectrometry (ICP-AES). Risk assessment was performed by calculating the daily intake (DI), hazard quotient (HQ), and the permissible daily consumption limit (CRlim). The measured concentration ranges (in mg/kg) were: As (0–0.834), Cd (0.0002–0.014), Hg (0–0.502), Pb (0–2.0), and Cu (0–1.203). The highest HQ values were found for the Tak brand (HQ = 1.657), driven by Hg, and the Zhik brand (HQ = 0.928), driven by As, indicating potential non-carcinogenic health risks. In contrast, the Zar, Mak, and Jahan brands exhibited HQ values below 0.01. A hybrid ensemble machine learning framework, combining Random Forest and Gradient Boosting, was developed to predict HQ. The model achieved high accuracy (R2 = 0.97, RMSE = 0.042) and identified mercury (34%) and arsenic (28%) as the dominant risk factors, followed by copper (16%), cadmium (12%), and lead (10%), confirming the deterministic results. This integrated approach provides a robust method for rapid food safety screening. Given the limited sample size (n=13), this study should be considered a preliminary exploratory investigation.