We know[1] that a more diverse group creates better group outcomes than a non-diverse group where specific individuals may have better performance. Even from a wholly selfish perspective for the people running a project, prizing diversity of qualified individuals over a pure meritocracy is the right play.
From a "making the world a better place" perspective where some altruism is shown, it also helps to acknowledge that not everyone has all the same advantages and tailwinds so that it is fundamentally more difficult for them to have had all the same opportunities and advantages, and providing those opportunities and advantages to them gives them that chance to even the playing field. The amount of unconscious bias built in to humans also means it is difficult for us to be effective judges of ability for those that are not like us. You don't have to be racist/exist/homophobic/transphobic/etc. to have built in biases - you just have to be human. They're difficult to overcome without explicitly stating goals around it.
[1] https://scholar.google.com/scholar?hl=en&as_sdt=0,44&as_vis=...