In Hosanna-Tabor v. EEOC (2012), the Supreme Court unanimously held that religious institutions have the constitutional right to freedom in selecting their clergy and religious teachers, notwithstanding federal or state antidiscrimination law. In Our Lady of Guadalupe School v. Morrisey-Berru (2020), the Court held (by a 7-2 vote) that this principle applies broadly as to all teachers whose job includes, even in part, "educating their students in the faith."
But does this also apply when the institution gets government funds, to which a nondiscrimination condition is attached? The question is complex, because analogies to other constitutional rules yield mixed results.
For instance, in the era when the Court recognized a constitutional right to abortion, it nonetheless upheld rules that say that abortions can't be performed on government property (even when they are done by a private physician who has privileges at the hospital). Likewise, Christian Legal Society v. Martinez (2010) upheld a rule that required student groups at public universities, as a condition of access to certain public funding and other public resources, accept all applicants as members or officers.