This paper deals with the optimal control of fractional Birkhof-fian systems based on the numerical method of variational integrators. Firstly, the fractional forced Birkhoff equations within Riemann–Liouville fractional derivatives are derived from the fractional Pfaff–Birkhoff–d'Alembert principle. Secondly, by directly discretizing the fractional Pfaff–Birkhoff–d'Alembert principle, we develop the equivalent discrete fractional forced Birkhoff equations, which are served as the equality constraints of the optimization problem. Together with the initial and final state constraints on the configuration space, the original optimal control problem is converted into a nonlinear optimization problem subjected to a system of algebraic constraints, which can be solved by the existing methods such as sequential quadratic programming. Finally, an example is given to show the efficiency and simplicity of the proposed method.