ALBANY – State budget talks went down to the wire last night with two key issues – the loft law and Medicaid cost-containment – tied to the outcome.

With the budget already three months late, Gov. Pataki and legislative leaders worked behind closed doors trying to put the finishing touches on a deal that is expected to raise state spending to nearly $74 billion, or $1.1 billion more than proposed by the governor in January.

If an agreement isn’t reached by midnight tonight, the loft law – granting rent protections to 10,000 mainly Manhattan tenants – and a law restraining Medicaid costs by as much as $1 billion a year will expire.

By early evening, insiders said the talks “could go either way” and while Pataki left the capital for a political speech in Boston, he was in touch with the legislative leaders by telephone.

“We can’t allow the hospital system in New York to collapse. We can’t allow hospital emergency rooms not to be there,” declared Assembly Speaker Sheldon Silver (D-Manhattan), who was pressing Pataki to hike Medicaid spending by up to $1 billion.

Silver was also seeking guarantees the governor won’t veto new spending measures favored by the Assembly – as he did last year.

“I’m normally very optimistic and positive, but I have great concern today,” said Bruno.

“We’ve been at this for over three months and we’re still not there.”

State lawmakers said that even if an agreement were reached last night, it would still be several weeks before a budget could be passed.

New York’s budget has been late for the last 15 years. The latest-ever budget was adopted on Aug. 4 in 1997.

Meanwhile, Pataki and Bruno are warning that the state, New York City and dozens of counties face up to $1 billion in additional Medicaid costs if existing cost-containment legislation is allowed to expire at midnight.