We propose a scheme to implement a quantum controlled-NOT (CNOT) gate between two four-level atoms inside the detuned optical cavity. The system state is evolved inside the decoherence-free (DF) subspace through stimulated Raman processes, which yields the desired unitary evolution operation for the CNOT. Our scheme is immune to decoherence due to dissipation of cavity excitation and spontaneous emission from the excited atomic level.