Federal authorities were warned last summer that some New York mobsters were planning to kill Secretary of Labor Raymond J. Donovan because of gangland fears that he might say something harmful to their interests, according to well-placed government and investigative sources.

One informed Reagan administration official said that it was never determined how serious the threat was, but investigators at the time were worried enough to notify the White House, which in turn told Donovan about the report.

The claim came from an informer "with a good track record," another source said, and was taken seriously until special prosecutor Leon Silverman closed his investigation of Donovan about two weeks later, which government officials concluded ended the danger. Silverman announced Sept. 13 that he had investigated a rash of new allegations against Donovan and concluded once again, as he had earlier in the summer, that there was "insufficient credible evidence" to warrant Donovan's prosecution on any charge. Throughout the inquiry, Donovan had denied any ties to organized crime.

When Silverman bowed out and the informer provided no additional information, several sources said, the FBI and the Justice Department decided there no longer could be any danger.

The report of a "contract" on Donovan came in the wake of the gangland murder on Aug. 25 of one of Silverman's witnesses, Nat Masselli. He was shot to death in the Bronx less than 48 hours before his father, William Masselli, a reputed member of the Genovese family of the Mafia, was scheduled to be called before a federal grand jury working under Silverman's supervision.

Donovan was interviewed by Silverman for about 2 1/2 hours in an unusual Sunday session on Aug. 29. A day or so later, sources say, the informer told federal authorities that organized crime figures were disturbed at Donovan's appearance before the special prosecutor and that some gangsters in Queens were planning to kill him.

The original warning went to another federal agency, which conveyed it to the FBI and the Justice Department, touching off an intensive investigation, sources said. One said the informer may have been "passing on bad information," but acknowledged that the individual had established his credibility in the past on organized crime activities.

When asked about the reports that Donovan was warned of the possible danger, Labor Department spokesman Vernon Louviere said yesterday, "I'm told he has no knowledge of it."

One high-ranking official, however, said White House counsel Fred F. Fielding was briefed on the informer's story and that Fielding notified Donovan.

It was learned elsewhere that rumors of a mob "contract" have more recently focused on William Masselli, the mobster who built a multimillion-dollar excavation and trucking business in the late 1970s as a subcontractor for Donovan's construction company on New York City subway projects. Convicted last year in two federal cases unrelated to Donovan, Masselli was serving a seven-year prison term at the Federal Correctional Institution in Ray Brook, N.Y., last summer when his son, Nat, was killed.

Authorities said yesterday, however, that he was moved to another undisclosed facility around the first of November "for his security." There also are reports, which could not be confirmed immediately, that he has been moved again.

"They're hiding him now," one investigator said. "They got word there was a contract out on him." According to this source, Masselli had aired his suspicions about who had killed his son and why.

Silverman said when he closed his investigation that there was no evidence "to date" of any connection between Nat Masselli's murder and the Donovan inquiry.

Later, Bronx District Attorney Mario Merola obtained murder indictments against two reputed members of the same branch of the Genovese crime family previously associated with William Masselli. A trial date has not been set.