No, theres a big difference between health and safety regulations (which are needed), and regulations interfering with the right to contract (which are not needed to the extent proposed in this thread). If I as a 40-something white man applied for a job at Michelle African Hair Braiding, for example, and I was the most qualified candidate, should the law require them to hire me? Of course not. If a Public Defender's office sees a specific need for a black staff attorney, should the law require them to hire a more qualified white candidate? Of course not.
I'm not sure how many people posting here actually own businesses and hire employees, but things are different in the real world. Businesses don't magically generate revenue, but do so based on the effort and abilities of their employees. Let me break it down for you:
(1) The female applicant is more qualified than the male candidate.
I'm with you.
(2) The sexist boss hire the male candidate. Its an irrational decision, but he does it anyway.
Still with you.
(3) The male candidate underperforms in his job, leading to a loss of revenue and profit for the company (he was the least qualified, remember?).
Just because the male counterpart is less qualified, doesn't mean he is completely incompetant. Let alone so incompetant that he causes loss of revenue and profit. He could be able to do the job, even if he wasn't as qualified. Maybe the discriminated individual would have been able to do the job better. And the only way to judge that is if ...
(4) The female candidate is hired by a competitor of the sexist boss. She performs exceptionally in her job (being more qualified). As a result, the competitor gains more business.
There just so happens to be the exact same job opening at the company's chief competitor. Which is a coincidence. Especially in a tough job market, kind of crazy that there were only two applicants and two jobs available.
(5) As a consequence, the sexist boss's company loses market share, which leads to a greater loss of revenue and profit.
Sheesh, that guy must really suck at his job.
(6) The competitor is happy and promotes the female who generates revenue to a position of management, because the competitor is self-motived with an eye toward maximizing profit.
If only there were always multiple openings for the same position in different companies, allowing everyone to have a shot.
(7) The sexist boss is unhappy and will be out of business in a matter of years. He'll likely blame the government, but it wasn't the government who put him out of business.
Yeah, he really really sucks at his job. I can't even imagine how bad he would have to be to single handedly destroy an entire company.