We show that a cavity optomechanical system formed by a mechanical resonator simultaneously coupled to two modes of an optical cavity can be used for the implementation of a deterministic quantum phase gate between optical qubits associated with the two intracavity modes. The scheme is realizable for sufficiently strong single-photon optomechanical coupling in the resolved sideband regime, and is robust against cavity losses.