How do you distinguish gender is a sentence like this?
In an actual text: context. In this case, both "he" and "she" should be correct.