The spatial phase distortion caused by turbulent atmosphere, target speckle, or optical system aberration causes decoherence of heterodyne signals. The decoherence effect is the key problem that imposes restrictions on the application of laser heterodyne techniques. We propose an approach for spatial phase distortion correction based on a genetic algorithm by establishing a one-to-one correspondence between combination of spatial phase compensation amounts and heterodyne efficiency of the system. The spatial phase distortion compensation problem is converted into a combinatorial optimization problem. The experiment results show that the method achieves excellent compensation performance for the spatial phase distortion, significantly contributing to the applications of heterodyne techniques.