Just when it appeared America's Olympic hockey team would be a loser even before the Games formally opened, Billy Baker scored on a 25-foot slap shot with 27 seconds remaining to salvage a 2-2 tie against Sweden tonight.

"That was a prayer," said U.S. Coach Herb Brooks, describing the goal that came about after Brooks had pulled goalie Jim Craig with 41 seconds left to get an extra skater onto the ice.

The 13th Winter Olympic will be opened cermonially Wednesday in a two-hour extravaganza that will feature 2,000 doves, 25,000 helium balloons, 1 million flowers and one vice president Walter F. Mondale.

Most of the hockey games today were poorly attended and scalpers were offering $20 tickets for $3 apiece. But that should really be no surprise.

Olympic tickets are grossly overpriced, the ballyhooed bus system has been a total disaster, there still is not enough snow on the ground and merchants all over town are wondering where all the big spenders are hiding.

Mondale will deliver what a spokesman described as "pretty much of a ceremonial speech.It's not supposed to be a major address. His official role is to represent the host country."

A crowd of 25,000 is expected for the ceremonies and the traditional parade of athletes from each nation. American speed skater Eric Heiden will read the Olympic oath to the athletes, and figure skater Scott Hamilton was elected by team captains to carry the United States flag in the parade, even though, at 5-feet 5, he is the smallest man on the U.S. team.

On the political front, the International Olympic Committee rejected President Carter's request that the Summer Games be moved out of Moscow, and the New York Supreme Court cleared the way for the first participation in the Games by mainland China since the 1949 Communist revolution. The court refused to strike down an IOC ruling requiring that the team from Taiwan must not compete under the flag of the Republic of China.

Joe Pacitti, technical director for the opening ceremonies, promises, "It's going to be fabulous."

Pacitti said in a recent interview: "Stirring, flamboyant. Flags, drums, fireworks, bugles. It will have it all.

The ceremonies will be the major event on Wednesday's schedule, though first runs in men's and women's luge are scheduled in the evening. The Games begin to get serious Thursday, with the 30-kilometer cross country race, the men's downhill, the women's 1,500-meter speed skating and a full schedule of hockey games.

There were fewer than 3,000 in the 8,000-seat stands of the Olympic Arena for the hockey games tonight. Those who came were treated to a wide-open game, albeit one filled with frustration for the American team.

In the first six minutes, the U.S. players had three breakaway opportunities -- all unsuccessful -- and at least four of their shots hit goal pipes.

Mostly, though, their shots were hitting Pelle Lindbergh, the outstanding Swedigh goalie drafted last year in the second round by the NHL's Philadelphia Flyers. Craig was hardly a stouch either as the Swedes fired 36 shots on net.

Sweden's Sture Anderson put his team ahead on a backhand from close in with 8:56 remaining in the first period.

The Americans, after what Brooks described as a talk "that was full of bleeps between periods, waited until there were 28 seconds left in the second period to fend off another Brooks lecture.

At that point, Mike Ramsey slipped a pass to Mark Johnson in the neutral zone, and Johnson and Dave Silk streaked in on goal almost side by side. Johnson slipped the puck to Silk and he beat Lindbergh with a high shot for a 1-1 tie.

Harald Luckner threw a perfect crossing pass in front of the goal to set up Jan Eriksson's stuff shot that put the Swede's ahead, 2-1, at 4:45 of the final period. And when the Americans squandered a power-play opportunity with six minutes left, gloom and doom permeated the arena.

Baker, captain of Minnesota's NCAA championship team last year and a third-round choice of the Montreal Canadians in 1976, changed all of that with some help from his friends.

Mark Pavelich dug the puck out of the corner, got it to Bill Schneider at the sideboards and he passed it in front to Baker, positioned all alone. His blistering shot whooshed through a wall of bodies and Lindbergh's dive came too late.

As the Swedish goalie lay in the crease, the Americans mobbed Baker at center ice as if they had just won a gold medal.