Gallagher’s, the legendary New York steakhouse at 228 W. 52nd St. since 1927, has been sold to Boathouse Cafe operator Dean Poll after a brush with death.

Poll yesterday confirmed to The Post he has definitively rescued the 200-seat institution by purchasing it from longtime owner Marlene Brody.

“It’s part of the fabric of New York, and I’m privileged to own it,” Poll said.

He said the restaurant will continue to be called Gallagher’s and retain its classic, early- and mid-20th century look, including a meat locker at the entrance and wood-paneled dining rooms festooned with vintage photos of entertainers, politicians, athletes — and racehorses.

However, “we might tweak the menu a bit,” Poll said of the frozen-in-aspic lineup.

Gallagher’s seemed doomed in October when Brody filed a closing notice with the state Department of Labor.

The Post reported at the time the place would close Jan. 16 unless a deal could be struck with suitor Poll — and the talks had broken down.

Poll yesterday said he also negotiated a new, 20-year lease at the building, which is half-owned by Brody. Restaurant workers union Local 100 has also “ratified” a contract, he said. Gallagher’s has about 90 employees.

Local 100 is not to be confused with a different hotel/restaurant union, Local 6, which thwarted Poll’s attempt to take over Tavern on the Green a few years ago.

Gallagher’s has long been a magnificent anachronism, serving its brand of unadulterated beef — typically USDA Prime and dry-aged — to generations of steak-lovers.

Customers often bumped into regulars like Shirley MacLaine, Jackie Mason, Broadway hoofers and even boxers heading for press conferences in the private upstairs room.

Gallagher’s benefited from the theater district’s cleaned-up street environment and tourism boom — but lost its appeal among a younger crowd enamored of modern steakhouses offering leaner, grass-fed and “artisanal” cuts.