Lithium (Li) dendrite growth in Li batteries is a long-standing problem, which causes critical safety concerns and severely limits the advancement of rechargeable Li batteries. Replacing a conventional liquid electrolyte with a solid electrolyte of high mechanical strength and rigidity has become a potential approach to inhibiting the Li dendrite growth. However, there still lacks an accurate understanding of the role of the mechanical properties of the metal electrode and the solid electrolyte in the Li dendrite growth. In this work, we develop a phase-field model coupled with the elastoplastic deformation to investigate the Li dendrite growth and its inhibition in the cell. Different mechanical properties, including the elastic modulus and the initial yield strength of both the metal electrode and the solid electrolyte, are explored to understand their independent roles in the inhibition of Li dendrite growth. High-throughput phase-field simulations are performed to establish a database of relationships between the aforementioned mechanical properties and the Li dendrite morphology, based on which a compressed-sensing machine learning model is trained to derive interpretable analytical correlations between the key material parameters and the dendrite morphology, as described by the dendrite length and area ratio. It is revealed that the Li dendrite can be effectively inhibited by electrolytes of high elastic moduli and initial yield strengths. Meanwhile, the role of the yield strength of the Li metal is also critical when the yield strength of the electrolyte becomes low. This work provides a fundamental understanding of the dendrite inhibition by mechanical suppression and demonstrates a computational data-driven methodology to potentially guide the electrode and electrolyte material selection for better inhibition of the dendrite growth.