Wall Street headhunter CTPartners has gone from predator to prey in just six short months.

The New York City-based executive search firm — once the seventh-largest in the US and one of the few publicly traded — is expected to file for bankruptcy on Tuesday after it was rocked by allegations of rampant sexual discrimination. Barring a white knight, CTPartners will close its doors and be sold off in pieces to its nearest rival.

Few could have predicted CTPartners’ swift collapse in December, when its stock was trading near a record high of $24. Led by then-Chief Executive Brian Sullivan, the firm was in expansion mode and buying competitors overseas.

Business was growing with banks and other companies hiring again after the downturn.

“The asset just started to deteriorate at a quicker pace than anyone could have imagined,” said David Hoffmann, chairman of DHR International, which is buying some of CTPartners’ assets.

Among the salacious accusations was that CEO Sullivan, along with three other executives, shed their clothes during a company-sponsored event at his house in 2012.

It got worse from there. Burke St. John, the vice chairman, was accused of pointing out his office window at shadows and asking women if the shapes resembled penises, according to the confidential EEOC complaint.

About a dozen women also had complained internally about discrimination, a former employee told The Post.

The same day the story ran, the stock plunged 24 percent, forcing CTPartners to pull an equity sale that would have raised about $12 million.

The allegations continued to hammer both its stock price and its reputation as clients and top partners fled the firm. CTPartners shares plummeted 33 percent on Jan. 29, when it slashed its earnings forecast and gave executives $1.7 million in bonuses.

In February, DHR offered to buy the company for $7 a share, which CTPartners rejected. Activist hedge fund Maguire Asset Management sent a letter to the board in April, adding to pressure on the company to find a buyer.

With the stock in free fall, shareholders sued the company and top execs, claiming they withheld information about sex-bias claims to inflate the stock price. Sullivan stepped down from the scandal-scarred firm in April.

But the damage was done, and CTPartners said recently that it would run out of money by June 30 and that it would likely file for bankruptcy and shut its doors as a result.

Rather than buy the entire company, would-be rescuer DHR now plans to feast on the carcass.