The objective of this article is to formulate a mathematical model to make a vaccination strategy to reduce outbreaks of influenza A (H1N1) via a fractional model, taking into account the time it takes for the vaccine to be active. For this purpose, the SIR model is modified by using the Caputo fractional derivative, unifying the unit of time on both sides of each equation, and adding the control variable with a time delay (the vaccine variable). Meanwhile, the theory of optimal control is used to construct an algorithm that enables us to determine the optimal vaccination strategy. The forward and backward Euler method has been used to find the optimal solutions numerically. The numerical simulation is based on data from Morocco's experience with influenza A (H1N1).