Might be worth asking Reddit's r/legaladvice (but take what they say with a grain of salt). In the UK this would be illegal afaik - you are only allowed to favour one sex over the other if there are two equivalent applicants for a position and you are trying to counteract an existing imbalance in your team. But you can't outright reject one sex from the start.
You have a couple different possible moves here:
1) Bring it up to your company's HR, compliance people, or legal team. If you want to stay and look good, this is an okay move. Frame it as, "This probably exposes us to A LOT of liability, no? Just thought I'd let you know".
2) Report them to the relevant authorities. This is the EEOC at the Department of Labor (Federal) and your state's EEOC or EEOC-equivalent. If you're planning on leaving I would definitely do this. Gather evidence of the illegal activity first and then submit. Many states will have whistleblower protections such that what the company can do to hurt you is very limited. You may even end up getting paid for no work.
3) Develop a list of candidates who were illegally discriminated against and notify them. They can then sue the company themselves.
1, 2, and 3 aren't exclusive. You can do a combination: for instance, let the company know and report them to EEOC. If you have the means and want to do a little good in the world, I think spending a couple hundred dollars on talking to a lawyer for an hour or two is a good move as well.