The opposition Labor Party's solid victory early today in a closely watched parliamentary by-election may, ironically, have given a long-term boost to Prime Minister Margaret Thatcher's Conservative government.

The winner of balloting in the northeastern city of Darlington was Oswald O'Brien, a local college administrator. The Conservative candidate came in second, well ahead of the candidate of the new Social Democratic-Liberal Party alliance. The seat had been held by Labor since 1964, so the outcome has no impact on the parties' parliamentary strengths.

But by-elections in Britain often become a focus of national attention throughout month-long campaigns. Thus they are important, as one long-time political analyst put it today, "in determining public attitudes and opinions," with significance well beyond vote counts. The outcome can affect such crucial decisions as the timing of a general election, the personal standing of party leaders and the shape of policies.

The main consequence of Labor's success in Darlington is to bolster the position of party leader, Michael Foot, virtually assuring that he will lead Labor in the next general election. The prevailing view among Conservatives is that Foot, a well-liked but unimposing figure, will make a weak opponent to Thatcher for the prime minister's post.

"Foot is one of our biggest assets," a Thatcher aide said.

Moreover, the third-place showing for the alliance brings an abrupt halt to a bandwagon that began with the last by-election in February, in which a Liberal won a resounding victory at Labor's expense.

That result produced a surge in the opinion polls for the alliance, making it the expected front-runner in Darlington. More generally, it raised anew the prospect that British politics is undergoing a fundamental realignment with a strong third force emerging between the traditionally left-wing Laborites and right-wing Conservatives.

But the alliance's candidate in Darlington, a regional television anchorman named Tony Cook, lost his edge because he had only a fuzzy grasp of such crucial issues as economic development and unemployment. His defeat by the affable, well-informed O'Brien and a young Conservative contender, Michael Fallon, shows that in a by-election, at least, the personal qualities of candidates can be more decisive factors than parties' national strength.

The alliance, however, remains an unpredictable new force in the country's politics. Even in its third place showing in Darlington it managed to get about 25 percent of the votes, well over twice as much as the Liberals alone received there in the last national election.

"It was a respectable result," said William Rodgers, one of the Social Democratic leaders, "but I won't deny for a minute that it was a disappointing one."

Darlington's message for the alliance appears to be that centrist support still tends to be shallow and based on a feeling of frustration with the older parties. As a result, voters will revert to the Tories and Labor in the course of a campaign unless the alliance can offer a clear-cut moderate alternative.

In gaining its celebrated success last month, the alliance defeated a Labor candidate who was regarded as an extreme leftist whereas this time, O'Brien was said to represent the party's "acceptable" center.

To some extent, the enormous attention given here to by-elections--special elections to fill individual vacancies--is more a function of popular fascination with a rousing political contest than an accurate assessment of the broader national mood. The countrywide opinion polls continue to show Thatcher's Conservatives with a comfortable plurality of about 10 percent over the other parties. It would be misleading to suggest that a Labor or alliance victory automatically reflects a looming problem for Thatcher.