NEW YORK, OCT. 27 -- Bronx District Attorney Mario Merola, who put the "Son of Sam" killer behind bars and unsuccessfully prosecuted former labor secretary Raymond J. Donovan, died today after a massive heart attack. He was 65.

Mr. Merola, who was was brought to Our Lady of Mercy Medical Center in the Bronx early today, died of a cerebral hemorrhage at 6:34 p.m., a hospital spokesman announced.

"This is a great loss for the entire state. He was a wonderful public official, a committed man, a family man," said Gov. Mario M. Cuomo, mourning the loss of a longtime professional and family friend. "His kind of quality will not be replaced," he added.

Mr. Merola had been kept alive on a respirator through the day.

Mr. Merola was found on the dining room floor of his home by his wife, Tullia, about 7:27 a.m.

The district attorney was stricken just two weeks before he was up for reelection.

While he was Bronx district attorney, Mr. Merola's most famous case since his election in 1972 was the conviction of "Son of Sam" killer David Berkowitz in 1977.

Berkowitz said he killed six people and wounded seven after receiving "commands" from a man named Sam who lived 6,000 years ago and transmitted his wishes through a dog.

Mr. Merola was unsuccessful in his attempt to convict former labor secretary Donovan of fraud and larceny charges. Donovan was acquitted after a long trialthis year.

Mr. Merola was appointed assistant district attorney in 1960 and was elected to the New York City Council in 1964, 1965 and 1969.