Gro Harlem Brundtland, a charismatic young politician picked to energize a sagging left-of-center government facing a national election in seven months, will become the first woman prime minister of Norway Wednesday.

She was selected today in Oslo by the ruling, union-based Labor Party to replace Odvar Nordli, 53, who is resigning because of ill health and the strain of managing a minority government with an increasingly divided and unpopular party for the past five years.

Brundtland, 42, currently Labor Party vice chairman and the foreign relations committee chairman in the Norwegian parliament, will be the first woman prime minister in Scandinavia. She will be the second currently in power in Europe, following Britain's Margaret Thatcher.

Brundtland faces an uphill struggle trying to unite the Labor Party and reverse its recent steep slide in public opinion polls before the election in mid-September. It has been hurt by power struggles, disagreements about defense policy and problems managing the economy despite rapidly growing North Sea oil wealth.

Public support for the Labor Party which has dominated postwar Norwegian politics, has fallen from 42 percent in the last national parliamentary election in 1977 to 36 percent in local government elections in 1979 to just 31 percent -- neck and neck with the opposition Conservative Party -- in the most recent opinion polls.

Although its future appears much brighter than many of its Scandinavian and European neighbors, Norway has not been immune from the combination of inflation and recession plaguing their economies. Nordli's government had been trying to hold down government spending, wages and prices, while beginning to shift the heavy tax burden financing the extensive welfare state from the unpopular income tax to a variety of indirect sales taxes.

The image of the Nordli government and the Labor Party has been hurt most, according to opinion polls and analysts, by internal dissension over defense policy that has become a national debate.

Labor's left wing fought a losing but loud battle against recent government agreements with the United States to stockpile American arms, ammunition and other supplies for use by allied troops and planes in the event of war with the Soviet Union, Norway's most powerful neighbor.

Although a member of NATO, Norway bans all foreign troops and nuclear weapons from its soil during peacetime. The argument about stockpiling grew into a national debate about whether Norway could still become a nuclear battlefield if there was war.

After first dragging its feet in negotiations with the United States, the Nordli government tried to placate its left wing and pacifist critics by shifting the stockpiling site hundreds of miles south from the Soviet border to central Norway and then launching a confused diplomatic campaign for a Nordic nuclear-free zone in peace and war.

Without spelling out her own preference for a formula, Brundtland said in a recent interview in Oslo that she wants her party to establish "a two-pronged policy" of maintaining a strong defense in full cooperation with the rest of NATO and "working more actively for nuclear disarmament."

"We can intensify our efforts for disarmament as an answer to the national debate," she said. "It may not work, but we can say that we are doing all that we can."

Brundtland was selected over the labor unions' candidate to succeed Nordli following a strong demonstration of grass roots popularity with declarations of support from local party organizations around the country. To mend fences, she made a few changes in the Cabinet -- keeping on as finance minister Ulf Sand, a prominent trade union leader -- despite the risk that she may appear to voters to be leading the same old government team into the election.

Labor will be counting on Brundtland's image as energetic and managerial, in contrast to Nordli's image of reserve and indecisiveness. She also is popular as an ardent environmentalist and is known for her support of women's rights, including abortion, an issue that divides the Conservatives from their opposition allies, the anti-abortion, rural-based Christian Party. f

Brundtland is a physician in Norway's public health service whose only Cabinet experience was an environment minister. Drawing on what she had learned about pollution problems at Harvard's School of Public Health during the 1960s, she campaigned for protection of Norway's environment from damage by North Sea oil production.