Traditional portfolio optimization strategies often rely on statistical methods and linear programming tools to achieve a balance between return and risk. Despite their usefulness for portfolio optimization, they cannot efficiently capture the specific differences and complexity of real-world financial markets. Several modern approaches attempt to overcome these limitations by using nonlinear models, machine learning, and advanced risk measures. In this study, we propose a novel strategy for optimizing portfolios that incorporates second-order stochastic dominance constraints and solves them with neural networks. we show that portfolios subject to second-order stochastic dominance constraints outperform their traditional counterparts, especially in tail-risk situations.