The fluctuation in the consumption of treated water is a situation that distribution networks gradually face. In times of greater demand, this consumption tends to suffer unnecessary impacts due to the lack of water. The uncertainty that occurs in water consumption can be mathematically modeled by a finite set of scenarios generated by a normal distribution and attributed to the network design. This study presents an optimization model to minimize network installation and operation costs under uncertainties in water demands. A Mixed Integer Nonlinear Programming model is proposed, considering the water flow directions in the pipes as unknown. A deterministic approach is used to solve the problem in three steps: First, the problem is solved with a nominal value for each uncertain parameter. In the second stage, the problem is solved for all scenarios, with the independent variables of the scenario being fixed and obtained from the solution reached in the first stage, known as the deterministic solution. Finally, all scenarios are solved without fixing any variable values, in a stochastic approach. Two case studies were used to test the applicability of the model and global optimization techniques were used to solve the problem. The results show that the stochastic solution can lead to optimal solutions for robust and flexible water distribution networks, capable of working under different conditions, considering the uncertainties of node demand and variable pipe directions.