Of course they can. In fact, religious schools that do this sort of thing actually stand up better under legal scrutiny as a truly religious institution. It's the half-@ssed frauds like Catholic Charities who would be out of luck here ... because they call themselves a "religious organization" even though they have no religious qualifications for their leadership positions, do not focus their activities on religious instruction or proselytization in any way, and (consequently) get more than 60% of their funding from the government.
I believe you will be shown to be mistaken. Think of “Bob Jones University”