Anders Jarryd and Stefan Edberg handed John McEnroe and Peter Fleming their first-ever loss in Davis Cup doubles play tonight to clinch Sweden's victory over the United States in the prestigious international tennis event.

Jarryd, at 23 the oldest member of the Swedish team, and Edberg, at 18 the youngest, beat the U.S. team, 7-5, 5-7, 6-2, 7-5.

The Swedes' performance on the indoor clay surface before a partisan home crowd completed a brilliant showing by the young host team. In Sunday's opening singles matches, Mats Wilander defeated Jimmy Connors, 6-1, 6-3, 6-3, before Henrik Sundstrom stunned a rusty McEnroe, 13-11, 6-4, 6-3, for a 2-0 lead.

It was Sweden's first victory in the Davis Cup over the United States, having lost the five previous matches between the countries, beginning in 1946.

The Swedes showed more heart on the big points and probably capitalized on the U.S. players' dislike for clay and their long breaks from competitive tennis. McEnroe, the Wimbledon and U.S. Open champion, had not played a tournament since Nov. 5. Fleming had not played for five weeks before coming here.

McEnroe, looking depressed, conceded Edberg's service had been a key factor. "I had difficulties with his service," McEnroe said. He then took another sideswipe at the court, saying: "This court is unacceptable for playing tennis on. The balls were bouncing over my head and all over the place . . . I think it should not be allowed."

But he then paid credit to the Swedish Davis Cup team. "They're a great team on clay, good on any surfaces, but they are obviously best on clay," he said. "We played bad, so we lost. They're very tough and they played better than us."

Wilander said Sweden deserved its success. "We had a better doubles team and two better singles players and it helped that we played on a clay court in Sweden," he said.

For McEnroe, who has played 56 Davis Cup matches for the United States, breaking Vic Seixas' record, it was his first loss in a Cup final. He had led the United States to victory four times since his 1978 debut against Britain at Rancho Mirage, Calif.

Before today's match, McEnroe and Fleming had won all 14 Davis Cup doubles matches they had played. But this was their second straight loss to the Swedish team; Jarryd and Edberg defeated McEnroe and Fleming in the semifinals of the U.S. Open in September, also in four sets.

Sweden's only other Davis Cup championship came in 1975, when Bjorn Borg led a 3-2 victory over Czechoslovakia in Stockholm. Last year, the Swedes reached the Davis Cup final, only to lose to Australia in matches played there on grass.

"We played both very well this time," said Edberg, who was never broken and was the outstanding player in the match. "In the U.S. Open semifinal, I did not play so well."

Tuesday's reverse singles in the best-of-five series pitting McEnroe against Wilander and Connors against Sundstrom will be shortened to best-of-three sets.

But it was not immediately known if Connors would play the final match in the first Davis Cup final of his long career. Connors' wife is expecting their second baby at any time and he made up his mind to play here only a few weeks ago. If Connors doesn't play, his place would be taken by the fourth member of the U.S. team, Jimmy Arias.

Earlier in the day, Connors was fined $2,000 for three counts of unsportsmanlike conduct during his match against Wilander.

Referee Alan Mills, in announcing the fine, said Connors would not be penalized for a verbal encounter he had with British umpire George Grime following his match with Wilander.

There was a possibility Connors could have been defaulted, an action that would have given the Swedes the title before today's doubles match.

No player has been defaulted in a Davis Cup final.