A firefighter works to contain a blaze that destroyed more than 50 homes during Hurricane Sandy in Breezy Point, Queens.Credit: Spencer Platt/Getty Images

Roughly 300 New Yorkers still living in hotels paid for by the city after being left homeless by Superstorm Sandy will be forced to vacate their rooms this week after a judge ruled the program was too costly to continue.

The hotel program was set up as a stopgap after city shelters were overwhelmed with people forced out of their homes by Sandy, which caused more than 200 deaths and $50 billion in damage along the East Coast. Thousands of homes were damaged or destroyed.

Providing hotel rooms to more than 3,000 people since the Oct. 29, 2012, storm has cost more than $70.5 million, New York City officials said on Monday.

Most of those who still remain in the Hotel and Interim Placement Program, which was funded by the city with the costs reimbursed by the Federal Emergency Management Agency (FEMA), are awaiting repairs to their homes or trying to find public housing assistance.

FEMA has said it will not make any additional reimbursements past Monday.

Without the financial support of FEMA, State Supreme Court Justice Margaret Chan ruled the city does not have "a budgeted source of funds" to continue running the hotel program.

"It is true the plaintiffs have suffered much and can do without another upheaval of moving into the shelter system," the judge wrote on Friday. "But the point of this upheaval is a lack of further funding from FEMA."

The hotels were located in all five of the city's boroughs, and rooms for the remaining 160 households have been paid by the city through this Friday, said Heather Janik, a spokeswoman for the New York City Department of Homeless Services.

Residents have been told they must leave the hotels, she said.

"Over this week they can work with their case managers to reconnect with family and friends they may have or with someone in the community they could possibly stay with. Or, of course, they can access the city's shelter system," she said.

Representing the displaced residents, the Legal Aid Society had sued to keep the program running and said many of those still in hotels were on the verge of moving out.

"We have a lot people that were about to move. Families that were supposed to move into their new homes a week from today," said Judith Goldiner, a Legal Aid attorney. "Others were all set to move out and they just need the city to inspect an apartment or approve an apartment.

"Instead, the city is saying, 'We don't care about any of that. You have to leave,'" she said.

Goldiner said most of the hotel residents lost everything in the storm.

Now, "they are scraping together just enough money to pay a deposit, first month's rent, a broker's fee," she said.

New York City's corporation counsel Michael Cardozo said in a statement that the hotel rooms were never intended to be a permanent solution. "As the court has recognized, the city cannot afford to single-handedly continue this program in the absence of FEMA funding," he said.