The threat of viral epidemics is a factor of economic security of the state. Its manifestation damages the life and health of the population, as well as the normal functioning of the economic system. The authors reveal the dialectical nature of the impact of epidemic threats on the economic security of the state. They prove that the destructive impact of the epidemic threat is manifested in the form of economic damage at all levels of the economic system (a decrease in economic activity of economic entities, a reduction in the volume of markets, a fall in real GDP). The authors note that there is also a creative impact of epidemic threats, which is manifested in the growth of incomes of enterprises specializing in medical products, as well as the development of new digital forms of economic activity that contribute to improving the economic security of the state. The authors proposed a formula for calculating the amount of reduction in the economic security of the state as a result of the introduction of quarantine measures. The formula can be adapted to calculate the value of a country's GDP loss over the entire period of the epidemic. The authors proposed the directions of state policy that can increase the level of economic security of the state in the face of the threat of epidemics (preventive, reactive and proactive), as well as measures for their implementation.