This paper is devoted to the Mayer problem on the optimization of nonlinear inequalities containing higher-order derivatives. We formulate the conditions of optimality for discrete and differential problems with higher-order inequality constraints. Discrete and differential problems play a substantial role in the formulation of optimal conditions in the form of Euler-Lagrange inclusions and 'transversality' conditions. The basic concept of obtaining optimal conditions is the proposed discretization method and equivalence results. Combining this approach and passing to the limit in the discrete-approximation problem, we establish sufficient optimality conditions for higher-order differential inequality. Moreover, to demonstrate this approach, the optimization of second-order polyhedral differential inequality is considered and a numerical example is given to illustrate the theoretical results.