Speaking to Federal employment law, Title VII of the Civil Rights Act of 1964, the law that establishes non-discrimination in employment based on race, sex, religion, and national origin, churches do have some leeway to discriminate.
For starters, the law only applies to organizations that have 15 or more employees and engage in interstate commerce, broadly construed. Plenty of churches are smaller than that, thus not covered at all.
Churches, even large ones, and many other religious organizations also are allowed to require adherence to their faith. They don’t all make that requirement for all positions, but in fact the law makes provisions for them to do so when reasonably justified.
Here’s the relevant exemption from the Act.
"(e) Notwithstanding any other provision of this subchapter, (1) it shall
not be an unlawful employment practice for an employer to hire and employ
employees, … on the basis of his religion, sex, or
national origin in those certain instances where religion, sex, or
national origin is a bona fide occupational qualification reasonably
necessary to the normal operation of that particular business or
enterprise, and (2) it shall not be an unlawful employment practice for a
school, college, university, or other educational institution or
institution of learning to hire and employ employees of a particular
religion if such school, college, university, or other educational
institution or institution of learning is, in whole or in substantial
part, owned, supported, controlled, or managed by a particular religion or
by a particular religious corporation, association, or society, or if the
curriculum of such school, college, university, or other educational
institution or institution of learning is directed toward the propagation
of a particular religion. "
There is currently no federal protection for homosexuals with respect to employment discrimination. There are some local laws that do offer some protection, and it would depend on the wording of those specific laws whether churches were excluded or exempt.
AFAIK, churches that are large enough to be covered by the law do not have any more leeway to discriminate on race than any other organization. Note that race is NOT mentioned in the excerpt from the Act. They do seem to be able to discriminate based on sex where the religion holds that only men can fill certain roles.