Four New York City municipal pension funds are investing $300 million into a trust connected to the country’s biggest alliance of labor unions in an attempt to address a dire housing shortage in the five boroughs, Comptroller Mark Levine announced Thursday.

The new investment in the AFL-CIO Housing Investment Trust marks the first allocation of its kind since Levine announced a plan to direct $4 billion in city pension funds over the next four years to build more apartments.

“This is a dramatic increase in the pace of investment because the crisis is worse than it's ever been,” Levine said. “There are projects all over the city where the zoning is ready, and they have a developer, but they're waiting and waiting and waiting for financing, and projects die because it can take years.”

New York City’s housing shortage has fueled record-high rents and an exodus of low- and middle-income residents in recent years. Less than 1% of all apartments priced under $2,400 a month are available to rent, according to the city’s most recent housing survey. And median asking rents have now reached $4,200 a month, an analysis by listings site StreetEasy shows.

Levine campaigned on using the comptroller’s fiscal oversight and pension management powers to help fight the housing crisis. The city’s five municipal pension funds have more than $326 billion in assets, according to the comptroller’s office.

The Housing Investment Trust is associated with AFL-CIO, the nation’s largest federation of labor unions. Member unions represent workers across a range of industries, including electricians, transit workers and postal employees.

The trust has helped construct more than 44,000 homes in New York City over the past four decades, according to its website, and officials say they plan to finance 10,000 more in the coming years.

The apartments constructed with loans from the AFL-CIO Housing Investment Trust are typically priced for middle-income residents or feature a mix of income levels, with luxury apartments and some units priced for lower-income renters. The projects require union labor.

They include a new 278-unit apartment complex on West 22nd Street in Chelsea and a 330-unit luxury building called the Ellery on West 43rd Street, where a quarter of the apartments are reserved for low- and middle-income tenants through the city’s housing lottery. Prices for a penthouse two-bedroom in the building reach $13,750.

The fund also financed construction of the 858-unit Brooklyn Crossing project near the Barclays Center, where 30% of units have rents capped for single adults earning up to $154,000 and households of four earning up to $220,000 a year.

The trust has recently financed improvement projects in Manhattan’s Penn South and Queens’ Electchester co-op complexes, where homes are meant to be affordable to middle-income owners.

Housing Investment Trust Marketing Officer Lesyllee White said the new city investment will specifically help the trust complete an upcoming loan to make improvements on another large Brooklyn co-op project. She declined to identify the complex before closing on the loan.

“We want to hit the ground running,” White said.

The trust is working with developers and co-op boards to finance a combined 10,000 proposed and existing units citywide, she said. Its investment strategy prioritizes a “competitive” rate of return from the new housing as well as the use of union labor and creation of affordable housing, according to federal filings.

“This is housing that’s going to continue to benefit municipal workers, fire, police, teachers,” White said. “Our feeling is, if you work in New York, there should be an avenue to live in New York.”

Levine said the city’s pension funds have directed more than $500 million to the AFL-CIO Housing Investment Trust since 2002 and seen steady return — a requirement for its investments.

Labor unions have long played a major role in New York City housing development.

Unions financed and built many of the city’s largest co-op complexes, like Co-op City in the Bronx and Rochdale Village in Queens, offering affordable housing to union members and other working-class New Yorkers.

The model has since changed, with union funds financing housing with a mix of market-rate apartments and some affordable units, with rents capped for low- and middle-income tenants.

Developers backed by building trades unions’ funds, not city pension dollars, now plan to build new housing on the site of the defunct Flushing Airport in Queens and, after decades of delay, at Atlantic Yards in Brooklyn.

Levine said the new investment reflects the role of labor unions in addressing the current housing crisis.

“Unions are increasingly alarmed about the housing challenges of their members, and members getting pushed farther and farther and farther from the city in order to find housing they can afford,” Levine said. “If you're working-class in New York City, you're struggling to find housing, and so unions want to help solve that problem.”