The study of the COVID-19 pandemic is of pivotal importance due to its tremendous global impacts. This paper aims to control this disease using an optimal strategy comprising two methods: isolation and vaccination. In this regard, an optimized Adaptive Neuro-Fuzzy Inference System (ANFIS) is developed using the Genetic Algorithm (GA) to control the dynamic model of the COVID-19 termed SIDARTHE (Susceptible, Infected, Diagnosed, Ailing, Recognized, Threatened, Healed, and Extinct). The number of diagnosed and recognized people is reduced by isolation, and the number of susceptible people is reduced by vaccination. The GA generates optimal control efforts related to the random initial number of each chosen group as the input data for ANFIS to train Takagi–Sugeno (T–S) fuzzy structure coefficients. Also, three theorems are presented to indicate the positivity, boundedness, and existence of the solutions in the presence of the controller. The performance of the proposed system is evaluated through the mean squared error (MSE) and the root-mean-square error (RMSE). The simulation results show a significant decrease in the number of diagnosed, recognized, and susceptible individuals by employing the proposed controller, even with a 70% increase in transmissibility caused by various variants.