A scheme is proposed for implementing the controlled phase gate for three atoms trapped in separated cavities coupled by optical fibers. The energy-level distances of the qubit system become unequal as a consequence of the virtual photon exchange between the atomic qubits, which allows the selective excitation of the qubit system in the symmetric Dicke subspace. The conditional phase shift is produced after a single selective Rabi oscillation and the operation is insensitive to cavity loss and fiber decay.