Water supply in the Mahdia region of Tunisia originates mainly from groundwater sources. As a common pool resource, these aquifers are highly susceptible to overexploitation, resulting in the classical tragedy of the commons. In this study, a hydro-economic optimization model was developed to determine the most efficient allocation of groundwater resources between farmers in the present and also by considering the needs of future generations. An economic analysis was performed with the model to find efficient policies that contribute to decrease aquifer overuse in normal and drought years and improve its sustainability. Financial analysis of returns and costs of producing irrigated crops were determined in the Mahdia-Ksour Essef aquifer, in which the benefits of drip, flood, and sprinkler irrigation were compared for each crop. The efficiency of alternative scenarios (baseline scenario “no policies undertaken” and water policy scenarios) were compared. Data for the analysis were obtained from multiple sources. Results show the importance of cooperation between farmers. The consideration of pumping costs along time in the farmers’ benefit equation allows the recovery of the water table level over the next two decades. This study assessed the importance of policy interventions to maximize social benefits for sustainable groundwater management. This paper introduced a case application of a dynamic model for managing an aquifer of the Mahdia region in Tunisia. This overused coastal aquifer requires the urgent application of the proposed water policies to maintain groundwater’s natural level and prevent the propagation of saltwater intrusion. © The Author(s), under exclusive license to Springer Nature Switzerland AG 2023.