Barneys’ latest effort to find a financial fix to stay afloat fell flat, The Post has learned.

The luxury retailer, which has been on a hunt for a buyer or investor to provide a cash infusion, was rejected by its primary lender last week when it requested an emergency loan, sources told The Post.

Barneys had been seeking what’s known as debtor-in-possession financing, a special form of financing provided for companies in financial distress — usually so they can pay their operating expenses while restructuring their business through bankruptcy.

But the bank, Wells Fargo — which has already extended $200 million to Barneys through a term loan plus $50 million through a revolving line of credit — decided the financial risk wasn’t worth it, sources said.

Without this financing, the storied retailer — which has been struggling since rent at its Madison Avenue flagship tripled in January — could be forced into liquidation, sources told The Post.

“There is all this last-minute desperation going on,” said a source with knowledge of Barneys’ financial situation.

Industry watchers have predicted that Barneys could file for Chapter 11 bankruptcy protection in July, which would have allowed it to continue operating while restructuring its debt. But the company needs financing to do it, industry insiders said.

A Barneys spokeswoman declined to comment on Wells Fargo or the company’s other efforts to find a financial fix to its problems, including searching for buyers or investors.

“The Barneys New York Board and management continue to work constructively and collaboratively with a number of parties and are committed to reaching a mutually agreeable resolution to strengthen our business,” the spokeswoman said.

A Chapter 11 would “require a DIP lender and I’m pretty certain that this is what’s taking so long to secure at this time,” said Hildun Corp. Chief Executive Gary Wassner, who has provided financing for Barneys’ vendors. “A surprise happy ending could still potentially be pulled from a hat.”

By the looks of Barneys’ flagship store on Madison Avenue, time could be running out. The Post found in a recent visit to the store that many shelves and racks are unusually sparse — even for minimalist Barneys, which allots generous spacing for its merchandise.

There were only six Rolex watches in a glass enclosed display with four shelves, while four small Balenciaga handbags were positioned in the middle of three or four foot-long shelves — and a long jewelry counter that was once filled with watches had just eight.

Some vendors that have a consignment arrangement with Barneys, particularly high-end jewelry and accessories brands, have asked for their product back — fearing that it will get caught up in a bankruptcy, sources said.

“The sparseness of the store could be due to brands asking for their product back and the fact that vendors have not shipped new merchandise in several weeks,” said Wassner.