A federal judge in Santa Fe yesterday ordered Gannett Co., the nation's largest newspaper chain, to return the Santa Fe New Mexican to its original owner, Robert M. McKinney, a Middleburg, Va., businessman.

The ruling, which Gannett plans to appeal, came after a six-man jury found that the company had breached a contract giving McKinney control for five years after Gannett bought the newspaper in 1976.

McKinney, 69, a former ambassador to Switzerland under President Kennedy and a board member of TWA and Martin-Marietta Corp., filed suit against Gannett in 1978 after a nasty dispute over whether McKinney could fire two editors over the content of an editorial.

Gannett, which owns 81 newspapers, seven television stations, and 13 radio stations, has a policy of "local control," often offering former owners of newly acquired newspapers the opportunity of remaining on as publishers after the sale.

When McKinney sold the New Mexican to Gannett, he asked that the company spell out this policy in a contract which gave him "complete authority over all employes." Fewer than a quarter of Gannett's acquistions are accompanied by such written contracts, a company spokesman said.

Allen H. Neuharth, chairman and president of Gannett, called Judge Santiago Campos' decision "outrageous" and "based on politics and provincialism rather than fact or law."

He added, "For the judge to attempt to punish Gannett so severely for the jury's finding of minor technical violations of an employment contract such as a few hirings and firings is a preposterous miscarriage of justice."

Marie-Louise de Montmollin McKinney issued a statement in Middleburg yesterday, saying her husband was "very pleased with the result. As the case is still pending he can have no further comment."

After a 14-week trial, the New Mexico jury found that Gannett had breached the contract on six occasions. First, Gannett replaced Stephen, Watkins, president and McKinney's right-hand man, with a Gannett official without telling McKinney beforehand.

A Gannett memo made public at the trial asserted that Watkins was fired because his "basic problem" was "he was unsure who he was working for" and would check with McKinney before carrying out instructions from Gannett officials.

Gannett officials, blamed a decision by employes to unionize on McKinney and Watkins. Watkins admitted in court that his relationship with employes was poor -- partly because he tried to include in their contracts an antinepotism provision and a prohibition on "people from the opposite sex living together in a relationship that was not near friendship," whatever the title.

Douglas McCorkindale, a Gannett vice-president, said yesterday the company had expected McKinney to be in New Mexico running the paper two-thirds of the year. Instead, he said, the Middleburg businessman, whose doctors had told him Santa Fe's altitude could aggravate his heart condition, spent less than a quarter of his time there.

The jury also found that Gannett breached the contract when the new president, N. Walter Ryals, and the managing editor, Barclay Jameson, refused to change an editorial McKinney wanted modified.

The editorial praised Democrat Bruce King and endorsed him for governor but also said "he has not addressed any of the campaign issues and prefers to stress his past record." McKinney wanted the criticism removed.

When Ryals and Jameson refused, he fired them. Gannett countermanded the orders and removed McKinney from management.

The jury also found that Gannett was not guilty of fraud or dishonesty or of signing a contract it never intended to honor.