In this paper, a collocation method based on the Jacobi polynomial is proposed for a class of optimal-control problems of a fractional distributed system. By using the Lagrange multiplier technique and fractional variational principle, the stated problem is reduced to a system of fractional partial differential equations about control and state functions. The uniqueness of this fractional coupled system is discussed. For spatial second-order derivatives, the proposed method takes advantage of Jacobi polynomials with different parameters to approximate solutions. For a temporal fractional derivative in the Caputo sense, choosing appropriate basis functions allows the collocation method to be implemented easily and efficiently. Exponential convergence is verified numerically under continuous initial conditions. As a particular example, the relation between the state function and the order of the fractional derivative is analyzed with a discontinuous initial condition. Moreover, the numerical results show that the integration of the state function will decay as the order of the fractional derivative decreases.