The past few decades by the emergence of such crises in the economic and social sphere of society, which resulted in economic supply shocks have been marked. Previously extremely rare, they have shifted the focus to the relevance of research on macroeconomic processes affected by shocks of this nature, not only in economic theory, but also in mathematical modelling. As a result of the analysis of already known macroeconomic models, it was revealed that the impact of external economic shocks on the main indicators of macroeconomics can have both negative and positive effects on economic growth. The purpose of the study is to build and analyze a dynamic optimization model, as well as recommendations for developing an optimal economic policy strategy. The article contains a description of the formulation and mathematical formalization of the macroeconomic task of levelling social damage from the impact of an external economic supply shock on the inflationary process and the unemployment rate. The connection between the two latter processes is established on the basis of the equation of the modified Phillips curve, supplemented by inflationary expectations, assuming a short-term perspective. The corresponding to this task economic and mathematical model is classified as an optimization model and represents the task of finding the conditional minimum of the loss functional. The article describes the qualitative analysis of this model, carried out using the methods of calculus of variations, formulas describing the dynamics of the above-mentioned macroeconomic indicators are obtained, a formula is derived for finding the level of inflation expectations at each moment of the time period under consideration. The obtained results of the mathematical model study are interpreted economically, while special attention is paid to the analysis of the impact of the external supply shock on these indicators.