The office portion of 160 Fifth Ave. is in contract to be purchased by one of its major tenants, the Simons Foundation, for around $185 million.

Sources said the retail, which has been majority-occupied by Club Monaco (since 1996) and a small Toby’s Estate Coffee in the building’s former lobby entrance, will be kept by the seller, Aby Rosen’s and Michael Fuchs’ RFR Holdings.

The deal pencils out at a whopping $1,500 per square foot for the office portion of the 150,000-square-foot building in one of the hottest areas of the city, the Flatiron District between Madison Square Park and Union Square.

RFR took control of the property in 2005 for $34,260,468, and it currently has a $110 million mortgage.

The recent Con Ed steam pipe explosion occurred right outside, but the building is now clean and open.

RFR is being represented by the Cushman & Wakefield investment team of Douglas Harmon, Adam Spies and Michael Collins, along with a JLL team. The sale is expected to close in the early fall.

Cushman & Wakefield also represents Simons Foundation in its leases at the building, which is located on the southwest corner of West 21st Street, with a lobby at 2 W. 21st Street.

According to CoStar data, the foundation moved there from 101 Fifth in 2009, to the sixth through ninth floors, and added the second floor in 2011 to total more than 76,000 square feet — but it is growing and needs more room.

Jim Simons, a genius mathematician who employed computational mathematics at his hedge fund, Renaissance Technologies, is now worth $20 billion and is a generous philanthropist.

He and his wife, Marilyn, created the foundation in 1994; with an annual budget of $300 million, it provides grants and supports programs to advance the frontiers of research in mathematics and the basic sciences — including, now, autism research.

The building has a commercial property tax exemption through an ICIP, which peels off in 2022. But taxes have climbed from $1.63 million in 2015 to a current $2.73 million.

As a nonprofit owner, the foundation could apply for a full exemption of its occupied portions.

The companies declined comment.