A scheme for generation of a three-Qubit W state is proposed in cavity QED based on nonidentical coupling between the atoms and the cavity. In this scheme, the atoms interact with a highly detuned cavity-field mode, the quantum information doesn't transfer between the atoms and cavity field, thus the cavity decay is negligible.