In general.... One can imagine certain circumscribed exceptions. If there is research, for example, in anthropology, culture or history on a particular group, then common sense might say that sometimes a member of that group could add specialized expertise, but in the cases you mentioned—astronomy, cancer research, climate change and so on—then, indeed, the sex and race should not make a difference.