A child's chubby hands trying to hammer a square peg into a round hole form the opening media shot in what is expected to be Attorney General Stephen H. Sachs' long, expensive and uphill fight to become the next governor of Maryland.

Sachs' 30-second commercial, which first aired on Baltimore television during the Redskins and World Series games on Sunday, is aimed directly at Sachs' unannounced but popular opponent, Baltimore Mayor William Donald Schaefer. The ad's message is that as successful as Schaefer may be as mayor of Baltimore, Sachs is the better choice for governor of the entire state.

"We think we need to get people to think beyond the reflex action of voting for simply the best known candidate and to get beyond Harborplace," said Sachs' campaign manager, Blair Lee IV.

To do that the Sachs campaign commissioned the ad, which cost $12,000 for the W.B. Doner Co. to produce and $50,000 to broadcast throughout the week around the state. It will be shown mostly in the Baltimore market, but can be seen in the Washington area this week during "M*A*S*H" and "Taxi," on WTTG (Channel 5), and on early morning news programs on CBS and ABC.

The commercial opens with a child's hands trying unsuccessfully to force the square peg into the wrong slot, as a man's voice says charitably, "Mayor Schaefer has been a popular mayor. Now some people think he should be governor. And they're pretty determined. Whether it's a good fit or not."

When the hands find a round peg, the voice says, "Fortunately, Attorney General Steve Sachs, who has been a strong voice for all Maryland, is also running for governor." And as the round peg slips easily into place, the voice concludes, "May the one who fits best win. Steve Sachs for Maryland."

The response from Schaefer's office can be summed up in the words of his press secretary, Pat Bernstein: "What ads? There'll be no comment on that."

A Schaefer political strategist, James Smith, said, however, "I think it's terrific that he's wasting his money a year ahead of time, but those aren't decisions other candidates have to make."

Sachs' campaign strategists hope the ads will serve several purposes. They were funded by $5 tickets sold by local Sachs supporters over the last several months, a campaign that Lee said has already netted $40,000 and will easily fill the budget. The low price was to underscore Schaefer's connection with the state's moneyed interests, who raised $1 million for the mayor at a fund-raiser last month.

The broadcast also was timed to coincide with Sachs' first full day of campaigning in Baltimore City, including a speeches at Coppin State College and the World Trade Center and a somewhat soggy walking tour of the Greek community in Highlandtown.

A recent poll published in the Daily Record, a Baltimore newspaper geared to the legal establishment, said that 53 percent of Democratic voters polled statewide favored Schaefer for governor versus 22 percent who liked Sachs. Six percent chose House Speaker Benjamin Cardin (D-Baltimore). The ratio of slightly more than 2 to 1 compared favorably for Sachs next to a Baltimore Sun poll taken last month, showing Sachs trailing by a ratio of 5 to 1. CAPTION: Picture, Stephen H. Sachs . . . $62,000 opening shot.