When Andrew P. Miller sought the Democratic nomination for governor last year, he bought extensive television advertising, hired a staff of about 35, and paid $5,000 for a steam locomotive to pull a campaign train across the state. His campaign cost $1 million and he lost.

This spring Miller, seeking the party's nomination to the U.S. Senate, bought no television time, had a smaller campaign trains. He planned to spend $169,000, and he seemed headed for victory.

While winning the party's nomination at a convention is unquestionably cheaper than a primary, the value of what Miller won is subject to dispute. The Virginia Democratic Party is the only state Democratic Party in the nation that has failed during the past 10 years to elect either a governor or a senator.

Bitter over his failure to defeat populist Henry E. Howell in last year's Democratic gubernatorial primary, Miller seemed well aware of the liabilities he faced as he campaigned for the Senate nomination among Virginia's badly divided Democrats.

"The party is in a situation where it is basically do or die," Miller said in a recent interview. "It is now a question of whether it will be a viable statewide force.If we don't put it together this year, the long dry spell will turn into a very serious drought ."

Those ate strangely pessimistic words coming from the man who barely a year ago appeared to be the front-runner for governor and was seen by many office holders as the man most likely to heal the decade-old liberal-conservative schism within the Virginia Democratic Party.

After seven years as an activist attorney general, he has been named by his peers as the outstanding state attorney general in the U.S. in 1977. He was running an apparently well oiled campaign for the Democratic nomination for governor against Howell, a former lieutenant governor who gave the appearance of staggering through a feeble, last hurrah.

Republicans feared that a Miller nomination would signal the consolition of moderated and conservative Democrats that would overwhelm their own conservative candidate, Lt. Gov. ohn N. Dalton.

However, a light turnout in the Democratic primary was dominated by the Howell faithful. Miller was narrowly upset, and then watched Howell take a drubbing from Dalton.

He became a partner in large Richmond law firm, Mays, Valentine, Davenport and Moore, but within a few months was thinking about the Senate race. "He misses the public life, one close friend said then, and at year's end Miller was in the race as the presumptive favorite in field of eight.

Politics has been a lifetime endeavor for Miller, a task that he would undertake with such seriousness that many politicians would call him bland and colorless.

His father, was viewed by many as a liberal and an irreverent challenger to the state's old conservative Byrd organization. The younger Miller appeared conservative in comparison with his father, who had nearly upset the Byrd-backed candidate in the 1949 gubernatorial primary.

Andres Miller, went on to Princeton and then the University of Virginia Law School, where he graduated first in his class and was editor of the scool's law review.

Reared in Fairfax County, Miller and his family moved to the Southwest Virginia town of Abingdon after law school. In five years there he established himself as a trial lawyer and a tireless Democratic official and campaigner for other candidates. He was president of the state Young Democrat William R. Spong made his successful run for the Senate.

In 1969, Miller made his first race for attorney general, defeating the party's conservative organization's candidate, Guy O Farley of Fairfax, in the primary, and Richard D. Obernshain, the Republican candidate, in the general. Against Obenshain and a conservative Democratic opponent, Miller got 52.7 percent of the vote.

He was easily reelected in 1973 over conservativeRepublican M. Patton Echols of Arlington with almost 71 percent of the vote.

Virginia Republicans had hardly nominated his old opponent, Obenshain, for the Senate race before Miller moved to the Political offensive. The day after the Republican selection of the conservative Obenshain, Miller said the choice showed the GOP "is a party that cares neither for the needs of people or the necessities of progress."

Two days later, he shifted the thrust of his attack. At a press confernce lat Tuesday, he declared, "There is a perception in the Republican Party that Dick Obenshain is not in the Party's mainstream. I welcome the support of those who may have supported John Warner or Linwood Holton," Obenshain's principal opponents for GOP nomination.

Taken together, the Miller reactions to the skeleton of the Republican nominee presented a revealing picture of Miller's political style - aggressive, calculating always on the lookout for the contrast with an oppoent that would put him in what he sees as the moderate-conservative mainstream of Virginia politics without dimming the image of progressive leadership that he wants to project.