They may be justified in taking diversity into account in the hiring process, but they cannot exclude candidates based solely on sex. In Regents of the University of California v. Bakke, SCOTUS held that candidates can not be excluded exclusively because of race. In Grutter v. Bollinger, they decided that it was legal to take it into account, but only on an individual basis, not to exclude candidates altogether. These both deal with race, but I see no evidence that sex would be treated differently since the same law applies to both.