Multi-conjugate adaptive optics (MCAO) is a crucial technology for achieving high-resolution imaging over a wide field of view with modern ground-based optical telescopes. The configuration of deformable mirrors (DMs) is a key component in the analysis and optimization of MCAO performance. Currently, the search for the optimal DM configuration often relies on iterative and time-consuming Monte Carlo simulations. This issue arises from the lack of an appropriate optimization method for DM configurations. The primary objective of this paper is to establish an optimization method for DM configurations in MCAO systems. We established a quantitative criterion for evaluating DM configurations by analyzing their correction capabilities for turbulence aberrations at different altitudes. Then, we optimized the DM configurations based on this criterion. This method provides a new theoretical foundation and practical tool for the design and performance optimization of MCAO systems. Based on the pupil phase structure function, we established a DM configuration evaluation criterion, namely the non-conjugate correction index (NCCI). Using NCCI as the optimal criterion, combined with the particle swarm optimization algorithm, we searched for the optimal solution across different DM configuration spaces. We conducted simulations based on the turbulence profiles of typical telescope sites. We validated our proposed theoretical model against Monte Carlo simulation models and find that the NCCI error ranges from 0.05 to 0.1. For optimizing DM conjugate heights, the results of our optimization algorithm differ by less than 1 km from those obtained via Monte Carlo simulations. Regarding the performance of the DM optimization algorithm, the average convergence accuracy error is less than 0.1 km, and the average convergence speed is approximately ten iterations. Additionally, our optimization method runs in just a few minutes; Monte Carlo simulations, in comparison, require several dozen hours.