Bona Fide Occupational Qualification (BFOQ) enables an employer to discriminate based on gender with respect to filling a particular job without being liable for discrimination under the Fourteenth Amendment's Equal Protection Clause. A BFOQ only very rarely justifies discriminating based on race. A rare example is hiring an actor of a particular race to fill a specific role in a movie or entertainment production.
An example of a BFOQ to justify excluding men from a job might be in hiring assistants to work in a women's bathroom or locker room.
The burden is on the employer to prove a legitimate BFOQ if it makes distinctions based on race or gender.