Madison Square Garden Corp., owner of the Washington Diplomats for the last two years, has decided to sell the team, it was learned last night.

And, according to informed sources, ysteve Danzansky, president of the team and a minority owner, is trying to assemble a group to buy the team and keep it in Washington, where it has operated for seven seasons.

If Danzansky is unsuccessful, and if another buyer cannot be found, Madison Square Garden is likely to turn over its certificate of ownership to the league.

League owners tried to stave off a Garden decision to sell last month, when they voted in favor of a schedule change that Garden Chairman Sonny Werblin has advocated for two seasons.

But in the end, sources said, the team's losses -- more than $5 million snce the team was purchased from San Juan Racing Inc. in October 1978 -- led the Garden to its decision to get out. The late Joe Danzansky, Steve's father, was a member of the board of directors of San Juan Racing Inc.

Danzansky will have a difficult time putting together a group by Nov. 14, when league owners meet in Chicago and the Garden is expected to announce its decision to leave the North American Soccer League.

Shortly after the league meetings, a 1981 schedule will be issued and to complete the schedule, the league must know whether Washington will be operating a franchise.That limits the time Danzansky or any other buyer has to put together a package.

Danzansky refused to comment yesterday on the situation, saying only, "I have nothing to say about Madison Square Garden's intentions. They have put up their bond (to operate the team next season) and I'm still hopeful that the Dipomats will be playing in RFK Stadium next season."

Neither Werblin nor Jack Krumpe, Garden executive vice president who has pushed for sale of the team, would return phone calls yesterday.

During Madison Square Garden's ownership, the Dips made huge strides in terms of credibility and acceptance in the Washington area. Attendance increased from an average of 11,000 fans per game in 1978 to 19,205 this past season.

One of the major reasons for the team's growth was the Garden's willingness to invest in name players, most notably Johan Cruyff. But even though such players as Cruyff gave the Dips credibility, they also increased the team's operating costs.

In their seven-year history, the Dips, who are touring the Far East, have made the playoffs four times, but have never advanced past the first round.

"The Garden has decided that this team is no longer a good investment," one source said. "Sonny Werblin wouldn't mind taking that kind of loss if the team was in New York where he could truly get enjoyment out of it. But he can't move it to New York because the Cosmos would demand such a huge indemnity fee. So he's getting out."

One thing that apparently frustrated Werblin was the league's unsettled labor situation, which, among other things, prevented him from negotiating a 1981 contract with the team's most important player, Cruyff.

As their October meeting in Toronto, league owners discussed the possibility of folding or merging several franchises so a Washington decision to drop out would not be a shock. But Commissioner Phil Woosnam said recently that he considers Washington one of the three most important cities in the league and he can be expected to try to help Danzansky keep the Diplomats in RFK Stadium.