Leaders of Maryland's major labor unions today endorsed Attorney General Stephen H. Sachs in his bid to become governor, putting behind him the support of the state's AFL-CIO organization that claims 400,000 members.

The endorsement, by a vote of 302 to 36 delegates to the Maryland state and District of Columbia AFL-CIO convention here, was seen by his supporters as a major boost to Sachs, who trails badly in preliminary polls behind the other major candidate, Baltimore Mayor William Donald Schaefer. A third candidate is House Speaker Benjamin Cardin, who also appeared before the group to ask for its blessing.

Edward R. Lamon, president of the organization, said the endorsement "in no way reflects any ill feeling toward Ben Cardin. We feel Steve Sachs, the attorney general, has the best chance of defeating Mayor Schaefer."

Lamon went on to list what he considers the many antilabor decisions during Schaefer's tenure. "He has the same record as Ronald Reagan on a subminimal wage for teen-agers. He has the same record as Ronald Reagan on enterprise zones. He authorized the creation of a nonunion trolley system in Baltimore," Lamon said.

Sachs, in a speech that preceded the closed-door discussion of the endorsement, told the delegates, "This election, ladies and gentlemen, is not over. The campaign has barely begun. Let the historians . . . show that the day the polls began to move was Oct. 8, 1985, when the men and women of organized labor . . . gave me their support."

Delegates jumped to their feet applauding in one of several standing ovations they gave Sachs.

His supporters say the endorsement brings Sachs the organizational and financial support of the state's unions, just over a year before the 1986 primary. It also is seen as countering the aura of invincibility that surrounds Schaefer, who has not announced he is running for office but who leads in every poll yet taken and was feted at a million-dollar fund-raiser last month.

In response to criticisms that the union leaders were stating a preference too early, Lamon said, "When you're facing a million-dollar war chest, you need to do a lot and you need to do it early."

Sachs' supporters are hoping to use the endorsement to portray Sachs as a candidate of the grass roots and Schaefer as a captive of business interests. They celebrated the endorsement immediately by distributing 500 tickets at $5 each, the proceeds of which will pay for Sachs' television commercials slated to air the week of Oct. 20.

In his speech today, Sachs emphasized his pro-labor record, saying, "The issues are very clear: I am with you and Mayor Schaefer is not."

Sachs made several pointed references to Schaefer, who addressed the group Monday to decry "rumors" that he favors a subminimum wage, right-to-work laws and other such measures.

"The mayor has now written a letter to deny that he supports right-to-work legislation. Well, I don't have any rumors to deny," said Sachs. "I have been against it all my life and when I am governor of Maryland if a right-to-work bill hits my desk I will veto it as fast as I can get a pen."

The endorsement was approved over the opposition of Baltimore City teachers, firefighters and several other mainly city-based municipal unions, some of them months away from entering contract negotiations with the mayor.

Fourteen union locals signed a joint statement Friday opposing an endorsement, saying an early announcement detracts from labor's clout. Opponents to the endorsement included Baltimore City teachers and firefighters. They were quietly joined by some nonunion leaders, among them Rep. Steny Hoyer (D-Md.) of Prince George's, who said, "I think there's still a lot of water that's going to go under the bridge. I think it's a mistake."

Many labor and union officials said the opposition came because Schaefer had "intimidated" the municipal unions. Harry Strovel, of the Ironworkers Local 16, called Schaefer's remarks to the group Monday "arrogance."

Schaefer had said, "There are those who are going to ask you to irritate me, to upset me, to make me mad. Fun and games. This isn't fun and games. You don't try to irritate a person, you try to work with them."

But Jeffrey DeLile, leader of the city's 2,200-member firefighters union who backed opponents of an endorsement, said, "We have no pressure from anyone to do what we're doing here."

However, DeLile also acknowledged that he and his union members are likely to support Schaefer in his gubernatorial aspirations. "I feel confident that by and large our people are going to go for the mayor . . . . He's [Schaefer's] just done too much for them over the years." The endorsement is not binding on all member locals.

Sachs said after the endorsement was announced, "I feel very close to labor and always have felt close to labor. It means a great deal to me to have the trust of friends."