This question is often discussed when we are hiring and often debated as well. The optimal candidate is elusive and often you are left having to accept some sort of tradeoff.
The way I always approach it is thinking about it in terms of the three main things that the ideal candidate would have. To me these are motivation, intelligence, and skill.
Those motivated will often be able to overcome obstacles and are driven to be successful.
Those intelligent, which in-and-of-itself is really difficult to quantify, have the aptitude to learn.
Those with the skill don’t need to be trained and the risk that they can’t do the actual job is diminished.
The problem is that finding the candidate with all three traits is rather difficult and you are left with a tradeoff. Which tradeoff would I take?
To me this question is simple, I would take any motivated and intelligent person over the highest skilled person or lack either of those traits. The person that is best but not motivated is far more difficult to manage than the person motivated with the desire and ability to learn the skill. The only tradeoff when someone lacks skill is time. Do you have the time to devote to the person to learn the necessary skills to complete the task.
The added benefit of taking someone lacking the skills is that they also come with less bad habits and/or preconceived ideas and ways of thinking that might be counter to what you are trying to achieve. Sure one could argue that those prior things could help your company grow, but they can also hurt you.
This sort of thinking right now is super important, the job market is very tight and applicant pools are very light, making a calculated tradeoff will help you fill the roles and, if done right, will create a better team in the long run.