The Times, Britain's oldest and best-known newspaper, and its companion Sunday Times will resume publication next month after management and a printers' union finally agreed today to end a bitter dispute that had prevented the papers from being published for nearly a year.

The agreement was announced late this morning after around-the-clock negotiations to beat a 4 p.m. deadline set by the newspapers' owner, the oil-rich Thomson Group of Canada. The agreement ends fears that the 194-year-old Times, a venerable British institution, would be sold or closed forever.

Officials and editors said the Times, the Sunday Times and the Times' three supplements would reappear about the middle of November. Thomson closed them last November 30 in an effort to force unions representing the more than 4,000 employes to agree to changes in work rules.

The shutdown had deprived the British establishment of its premier newspaper, past its 19th century heyday but still more influential than its modest 300,000 circulation indicated. It recorded the births, engagements, marriages and deaths, and the comings and goings of royalty.Its letters' columns aired policy debates. Its literary supplement reviewed the establishment's books, and its educational supplements kept watch on its schools and universities.

Even competitors among Britain's "serious" or "quality" national newspapers -- all of which picked up hundreds of thousands of extra subscribers in the absence of the Times and Sunday Times -- worried in their editorial columns about the papers threatened demise. They covered the climactic days of the labor dispute on their front pages.

The Times' management had wanted to increase productivity, introduce computerized printing technology, end wildcat strikes and reduce the control that powerful printing unions traditionally have exercised over production of Britain's national newspapers in London's Fleet Street.

In the end, in return for sizeable pay raises, the unions agreed to about a 16 percent reduction in manning, end to wildcat strikes and acceptance of new technology that will remain under the printing unions' sole control for at least a year.

"It was not a big breakthrough," Thomson official Gordon Brunton said of the agreement, that ended a strike that has cost his organization an estimated $60 million. Most of this was spent on salaries for Times' executives, journalists and other workers who remained on the payroll during the months of ultimatums and on-and-off negotiations characterizing the often melodramatic dispute.

Printers' union leader Les Dixon called it a "fair deal to both sides." But one of his negotiators, William Booroff, said, "If you look over the whole dispute, we have won on every major issue."

When asked what the Times' management had gained, Booroff said, "They have made comparatively little, but they do have full operating agreements and guarantees of continuity of production."

He said, "The biggest mistake of management was to stop publishing the papers. It left them without any advantage they'd had.

Harold Evans, editor of the Sunday Times, agreed that management greatly miscalculated in closing down the papers to force the unions to agree to its terms. But he said he was happy with the agreement because changes in working rules would make it possible for his paper to grow in size and easier to get 1.7 million copies to subscribers on time each Sunday.

The union leader for Times' reporters and editors -- many of whom have been paid full salaries, plus a recent raise, throughout the dispute -- called it all "a waste of eleven months. If the management wanted to hand out large sums of money, they could have done it before suspension of publication and avoided all this."

Lord Thomson, who inherited the Times newspapers and other business interests from his father, expressed only his "great relief and anticipation and great satisfaction that we're going back into publication."

After his father lost as much as $2 million a year operating the inefficiently run papers, Thomson improved management and moved the Times and Sunday Times into the black.

He then decided to do something about costs and production problems that the Times management blamed on outmoded printing technology, union feather-bedding and frequent wildcat disputes. The wildcat problem in 1978 alone prevented the newspapers from printing and distributing millions of copies.

The Thomson organization had struck it rich in North Sea oil investments, and some of the profits were earmarked for the struggle with the unions at the Times. But when the deadlock consumed the $50 million that had been set aside, Thomson seriously considered permanently closing or selling the newspapers.

Last week, Lord Thomson flew here from the Thomson organization's Toronto headquarters after setting the latest in a long series of deadlines for a settlement with the union. When negotiations with the last printers' union, Dixon's National Graphical Association, broke down on Thursday, Thomson convened his board to decide what to do next.

The Times management set another "final" deadline at 4 p.m. If agreement were not reached by then, management announded, all of the 4,200 Times employes except 500 journalists, executives and key building personnel would be fired. Sources said ways to publish the newspapers away from Fleet Street in Britain or Europe would be explored, although attempts to publish in other locations during the past 11 months have consistently failed.

Meanwhile, the unions that had already reached agreement with management but whose jobs were now threatened, put pressure on Dixon and his 640 members at the Times to try again at the bargaining table. An agreement was reached this morning when both sides said they would submit the question of manning to binding arbitration.

The Times has given Dixon's printers at least a year of sole jurisdiction over computerized printing equipment, while negotiations are held with management and the journalists' union over sharing access to the equipment. Although many journalists in the United States have been writing and editing newspaper stories on computer consoles for several years, printers' unions have kept control of computer terminals at every British newspaper where the terminals have been introduced.