Quality failures in the flexible packaging industry increase production costs, generate material waste, and negatively affect manufacturing sustainability. This study developed an integrated Data Analytics model for quality failure management by combining descriptive, diagnostic, predictive, and prescriptive analytics. A dataset containing 1242 real production records was analyzed using operational variables including material grammage, production speed, ambient humidity, paper type, and reel type. Several ML classification algorithms were evaluated, including Logistic Regression, K-NN, SVM, Naive Bayes, Decision Tree, and Random Forest. Model performance was assessed using Accuracy, Precision, Recall, F1_Score, and AUC-ROC metrics. The results showed that nonlinear models achieved superior performance in defect detection compared with linear approaches. Decision Tree obtained the best balance between predictive performance and interpretability, achieving a Recall of 0.927 and an F1_Score of 0.962, while Random Forest achieved the highest AUC-ROC value (0.995). To assess model robustness and reduce the risk of overfitting, a 5-fold cross-validation procedure was applied, confirming the stability and generalization capability of the selected model. A prescriptive optimization model was subsequently integrated with the Decision Tree classifier to identify process configurations associated with lower defect probabilities and lower expected production costs. The proposed framework supports data-driven quality management, reduces the likelihood of defective production, and contributes to sustainable manufacturing through improved resource utilization, lower waste generation, and more efficient operational decision-making.