Sweden's three nonsocialist parties won last Sunday's national election by just 8,000 votes and a single seat in Parliament, the Swedish government announced tonight after counting 40,000 absentee ballots.

The nonsocialists received nearly 60 percent of the votes from the absentee ballots, to win the decisive parliamentary seat from the opposition Social Democrats, under Sweden's system of proportional voting. There will be a routine recount, but it is not expected to change the outcome.

Now, the three nonsocialist parties -- the Liberals, Center Party and Conservatives -- which first came to power in 1976 after 44 years of governments controlled by the Social Democrats, must agree on a prime minister and form a new government.

Prime Minister Ola Ullsten announced tonight that he would resign to open the way for negotiations with Center Party leader Thorbjorn Falldin and Conservative leader Gosta Bohman on the composition of the new government.

Falldin became the first prime minister of the nonsocialist coalition government in 1976 but he resigned last year when he could not agree with his coalition partners on a nuclear energy policy. Ullsten then became prime minister of a minority Liberal Party government.

One of the two is expected to emerge as prime minister in the new coalition government, with the other talking a top Cabinet position, probably that of foreign minister. Conservative leader Bohman is expected to serve again as economics minister. All three would share in government policy decisions.

The negotiations may be much more difficult than that, however. Bohman's Conservations have replaced Falldin's Center Party as the largest nonsocialist party, winning 73 of the nonsocialists' 175 seats in the 349-seat unicameral Swedish Parliament. It is believed impossible for Bohman to become prime minister, however, because the Conservatives, even after winning 20 percent of the vote in this election, are considered too far to the right for Sweden. In their opponents' eyes they are comparable to Prime Minister Margaret Thatcher's Conservatives here in Britain.

In fact, none of Sweden's nonsocialist parties seeks to shrink the comprehensive welfare state the Social Democrats have built up over four decades. The Conservatives want only to limit its future growth, cut income taxes and eliminate what they see as excesses of welfare-state bureaucracy. The Center Party is more concerned about ecological problems and wants to restrict Sweden's nuclear power program. The Liberal party is barely discernible in its policies from the Social Democrats, although it does not want government or the labor unions -- the Social Democrats' foundation -- to take over private business.

Both the Liberal and Center parties lost ground in this election, with Falldins' Center Party doing particularly badly after losing its nuclear power issue to a referendum to be held in March. That referendum could post a problem for the new coalition government, with Falldin's party campaigning to limit Sweden to its present six operating nuclear reactors for safety reasons, and his coalition partners preferring to double the number of reactors to reduce Sweden's costly dependence on imported oil.

Olaf Palme, leader of the Social Democrats, who was Sweden's prime minister from 1969 until 1976, predicted this week that a nonsocialist government would not survive long after the March referendum and that new parliamentary elections might take place as soon as next summer.

If the new government lasts longer than that, it is almost certain to make some reduction in Sweden's high income tax rates, which Bohman and others say are reducing the Swedes' incentive to work long hours and encouraging them to cheat the government through "black economy" tax-evasion schemes. Following Bohman's lead, Ullsten and Falldin offered their own joint tax-cutting proposal near the end of the election campaign.