We introduce a new preference relation in the space of random variables, which we call robust stochastic dominance. We consider stochastic optimization problems where risk-aversion is expressed by a robust stochastic dominance constraint. These are composite semi-infinite optimization problems with constraints on compositions of measures of risk and utility functions. We develop necessary and sufficient conditions of optimality for such optimization problems in the convex case. In the nonconvex case, we derive necessary conditions of optimality under additional smoothness assumptions of some mappings involved in the problem.