Lt. Gov. Melvin A. Steinberg's long search for a running mate ended in the nick of time yesterday as he tapped a veteran lawmaker from Southern Maryland after the man he was poised to announce suddenly changed his mind.

Mr. Steinberg, a candidate for the Democratic nomination for governor, chose state Sen. James C. Simpson to fill the lieutenant governor's slot on his ticket less than seven hours before the 9 p.m. filing deadline.

Under Maryland law, a candidate for governor must select a lieutenant governor running mate to be eligible to run in the Sept. 13 primary election and the Nov. 8 general election.

Mr. Simpson, 63, of Charles County was rushed into the lineup as a replacement for former Prince George's County state Sen. Thomas P. O'Reilly, 55, who told Mr. Steinberg yesterday afternoon that he had ethical concerns about running.

Mr. O'Reilly, sworn in yesterday morning as a member of the state Workers' Compensation Commission, said he had been warned by friends and associates, including some judges, that campaigning foroffice while serving on the quasi-judicial panel could create the appearance of impropriety.

Mr. O'Reilly said his main concern related to contributions that might go to the Steinberg campaign from lawyers specializing in workers' compensation cases. Mr. Steinberg said he understood O'Reilly's concerns and agreed that, to avoid even a suggestion of impropriety, he should not run, though there was no legal bar to his candidacy.

Seemingly concerned that his choice of Mr. Simpson might be viewed as having a slap-- quality, Mr. Steinberg maintained that the men resemble one another in their political posture and in other ways, including their silver gray hair.

"He has so many similarities to Tom O'Reilly," Mr. Steinberg said of Mr. Simpson. "One is their physical appearance. They look alike," he said jokingly, adding, "We don't have to change the signs."

Physical resemblance aside, Mr. O'Reilly might have brought more to the ticket in conventional political terms. Mr. Steinberg would have been seen as raiding the backyard of the front-runner in the Democratic primary race, Prince George's County Executive Parris N. Glendening.

In addition, an O'Reilly candidacy might have helped Mr. Steinberg more in the heavy voting suburban Washington counties, where Mr. Steinberg trailed Mr. Glendening 56 percent to 2 percent in the most recent independent poll.

As Mr. Steinberg and Mr. Simpson officially filed yesterday, former Baltimore County Executive Donald P. Hutchinson, who had been considering a run for governor, declined to enter the Democratic field.

Mr. Hutchinson, who heads the Greater Baltimore Committee, could not be reached for comment. But Dennis C. McCoy, a former state delegate active in the Hutchinson boomlet, put weeks of speculation to rest.

"He told me he was not running," Mr. McCoy said. He said Mr. Hutchinson felt there was insufficient time to raise the issues that concerned him.

"He also thought that the large number of candidates from the Baltimore metropolitan area would damage his chances," Mr. McCoy said.

Sources said that Mr. Hutchinson and his political advisers looked at vote totals from past elections last week and decided that he could not win if Mr. Steinberg remained in the race, even if he fared poorly.

Over the weekend, sources said, a futile effort was mounted by those backing Mr. Hutchinson to persuade Mr. Steinberg to drop out of the race.

With the passing of the filing deadline, the gubernatorial field is now complete.

The four major Democratic candidates are Mr. Glendening, Mr. Steinberg, Baltimore state Sen. American Joe Miedusiewski and Montgomery County state Sen. Mary H. Boergers.

As expected, Ms. Boergers yesterday named former state Del. Barbara O. Kreamer of Harford County as her running mate, giving Maryland its first all-woman ticket.

The three major Republicans competing for their party's gubernatorial nomination are U.S. Rep. Helen Delich Bentley; Ellen R. Sauerbrey, the Maryland House minority leader; and retired foreign service officer William S. Shepard.

In tapping Mr. Simpson, Mr. Steinberg has chosen a 20-year veteran of the state Senate who announced a few months ago that he would not seek re-election this year.

Mr. Simpson, a Korean War era Marine, started a wholesale beer distributorship that he owned for 32 years until selling it five years ago. In recent years has been vice chairman of the Senate Finance Committee.

In Annapolis, Mr. Simpson is known for his gravelly voice and a common sense approach to legislating. He is viewed as a fiscal conservative who often sides with business interests.

On some key issues, however, he and Mr. Steinberg disagree. They include abortion rights and gun control -- both of which the lieutenant governor supports and Mr. Simpson opposes.