The fluctuation of the vapor cell temperature leads to the variations of the density of the alkali metal atoms, which seriously damages the long-term stability of the spin-exchange relaxation-free (SERF) comagnetometer. To address this problem, we propose a novel method for suppressing the cell temperature error by manipulating the probe laser frequency. A temperature coefficient model of the SERF comagnetometer is established based on the steady-state response, which indicates that the comagnetometer can be tuned to a working point where the output signal is insensitive to the cell temperature fluctuation, and the working point is determined by the relaxation rate of the alkali metal atoms. The method is verified in a K-Rb-21Ne comagnetometer, and the experimental results are consistent with the theory. The theory and method presented here lay a foundation for the practical applications of the SERF comagnetometer.