Exactly 27 years to the day after Bernhard Goetz — famous in New York lore as the “Subway Vigilante’’ — shot four young men he thought were threatening him on a train, one of them killed himself by swallowing prescription pills in a low-rent Bronx motel, authorities said.

James Ramseur, 45, was found dead of an apparent overdose at 11:30 a.m. at the Paradise Hotel, at 2990 Boston Road, law-enforcement sources said last night.

He was in bed and fully clothed.

Ramseur had checked in on Tuesday and paid for two nights. He was supposed to check out yesterday morning.

When he failed to show up at the front desk, hotel staff went to his room and discovered his body.

In the toilet was the bottle that had contained the pills that apparently killed him.

But Ramseur had scraped the label off so the pills could not be identified, and toxology tests will take at least a month.

Ramseur had an ID card on him, so he was identified immediately.

No suicide note was found and there were no wounds on his body.

Police believe he had spent the entire time in the hotel alone. They knew of no visitors.

Cops called Ramseur’s sister, and she confirmed his identity and his role in the storied 1984 shooting incident.

Ramseur got out of prison only 17 months ago, after serving 25 years upstate for raping a young woman on a Bronx rooftop.

The shooting happened on Dec. 22, 1984, when Ramseur and neighborhood pals Darrell Cabey, Barry Allen and Troy Canty were riding a downtown No. 2 train.

As it approached Chambers Street, they encountered Goetz, an electronics specialist, and what ensued is in dispute.

Goetz told authorities the intimidating youths demanded $5 from him. The teens insisted they were only panhandling.

Goetz fired five shots from his Smith & Wesson, hitting all of them.

Ramseur was wounded in the arm.

Many residents of the city, which was then undergoing an unprecedented era of street crime, hailed him as a hero.

But since the four youths were black, others called him a racist.

He was convicted of illegally possessing a loaded firearm, but cleared of the more serious charges — four counts of attempted murder.

Cabey, who was paralyzed when Goetz shot him at close range, won a $43 million lawsuit against Goetz, who declared bankruptcy and hasn’t paid a dime.

Cabey, by far the most seriously injured, still is confined to a wheelchair and functions with the intellect of an 8-year-old.

Allen was convicted of robbery in 1991 and released from prison four years later.

Canty racked up a string of petty offenses, and once served 18 months in a residential drug-treatment program.

Additional reporting by Larry Celona