Precipitation extremes have surged in frequency and duration in recent decades, significantly impacting various sectors, including agriculture, water resources, energy, and public health worldwide. Pakistan, being highly susceptible to climate change and extremes, has experienced adverse events in recent times, emphasizing the need for a comprehensive investigation into the relationship between precipitation extremes and crops production. This study focuses on assessing the association between precipitation extremes on crops production, with a particular emphasis on the Punjab province, a crucial region for the country's food production. The initial phase of the study involved exploring the associations between precipitation extremes and crops production for the duration of 1980–2014. Notably, certain precipitation extremes, such as maximum CDDs (consecutive dry days), R99p (extreme precipitation events), PRCPTOT (precipitation total) and SDII (simple daily intensity index) exhibited strong correlations with the production of key crops like wheat, rice, garlic, dates, moong, and masoor. In the subsequent step, four machine learning (ML) algorithms were trained and tested using observed daily climate data (including maximum and minimum temperatures and precipitation) alongside model reference data (1985–2014) as predictors. Gradient boosting machine (GBM) was selected for its superior performance and employed to project precipitation extremes for three distinct future periods (F1: 2025–2049, F2: 2050–2074, F3: 2075–2099) under the SSP2-4.5 and SSP5-8.5 derived from the CMIP6 (Coupled Model Intercomparison Project Phase 6) archive. The projection results indicated an increasing and decreasing trend in CWDs (maximum consecutive wet days) and CDDs, respectively, at various meteorological stations. Furthermore, R10mm (the number of days with precipitation equal to or exceeding 10 mm) and R25mm displayed an overall increasing trend at most of the stations, though some exhibited a decreasing trend. These trends in precipitation extremes have potential consequences, including the risk of flash floods and damage to agriculture and infrastructure. However, the study emphasizes that with proper planning, adaptation measures, and mitigation strategies, the potential losses and damages can be significantly minimized in the future. [ABSTRACT FROM AUTHOR]