The lack of standardized recipes in Indonesian traditional cuisine hinders Micro, Small, and Medium Enterprises (MSMEs) from complying with food safety regulations, specifically allergen labeling. Current manual identification methods are inefficient, prone to bias, and prohibitively expensive for routine industrial screening. This study proposes a cost-effective, automated computational framework to detect allergen risks and support product reformulation. Utilizing a dataset of 9,921 recipes extracted from the Cookpad portal, the research applies a semi-supervised approach combining K-Means Clustering for risk labeling and Random Forest for classification, mapped to 14 EU allergen standards. To ensure industrial reliability, Data Augmentation and Random Over Sampling (ROS) were implemented to address class imbalances common in traditional recipes. The experimental results demonstrate that the model, optimized via Bayesian Optimization, achieves near-perfect accuracy (0.999) and high sensitivity (Recall 0.997), effectively minimizing the risk of false negatives critical for food safety. Furthermore, Bayesian Optimization proved to be 6.2 times faster than Grid Search, offering a computationally efficient solution for scalable implementation. Beyond detection, this study introduces an innovative "Ingredient Substitution Advisor" based on clustering patterns to assist food technologists in formulating hypoallergenic products. This framework contributes to the digitalization of food safety systems, providing an accurate, low-cost alternative to support HACCP implementation and certification for the agro-industry.