When underdog Virginia Democrat Edythe C. Harrison began her campaign for the U.S. Senate, friends and foes alike agreed on one thing: The feisty Harrison might not win, but Republican Sen. John W. Warner would know he had been in a fight.

In the closing days of what may prove to be the most lopsided Virginia political campaign in modern history, Harrison is trailing badly in opinion polls but is living up to her billing.

Her attack on Warner's holding of stocks in defense-related industries and their large political action committee donations to his campaign have clearly stung the first-term senator, a member of the Armed Services Committee, who acknowledges that reports of wasteful military spending have voters "hopping mad."

Warner, a multimillionaire who has about $350,000 of his $4 million net worth in stocks, said Friday he would "reexamine" his holdings after the election to determine whether he could do more to avoid "even the perception of a conflict of interest."

The stock ownership issue, which could persist for Warner beyond Tuesday's elections, appears to have come too late to affect the campaign in which Warner leads Harrison by 62 to 20 percent in one recent poll. The worst election defeat in modern Virginia occurred in 1976 when former senator Harry F. Byrd Jr., an independent, defeated his Democratic rival, Adm. Elmo R. Zumwalt, 57 percent to 38 percent.

Harrison also has confronted Warner on such issues as his opposition to some civil rights bills, student loans and aid to families and his support for budget deficits.

Harrison's attacks, however, follow a summer and fall during which she was beset with a host of campaign problems.

From the beginning of her pursuit of the Democratic nomination, Harrison has been unable to gain more than token support from her party; she has been crippled by fund-raising that has fallen more than 60 percent short of its goal; and she has struggled through several campaign staff changes that sidetracked her for weeks.

A highly touted "volunteer force" failed to materialize as consultants and campaign managers came and left. She has only a few campaign offices and owes nearly $50,000 in rent, telephone and other routine expenses. A last-minute media campaign is limited to a few television spots and ads on black-oriented radio stations.

"Certainly everyone, including Edie, recognized it was an underdog candidacy," said Robert P. Crouch, Democratic chairman of Southside Virginia's 5th Congressional District and an early Harrison supporter. "There were some organizational glitches . . . which prevented the opportunity to make the best possible race of it."

Harrison, a 50-year-old, former state legislator from Norfolk and the first woman Senate candidate backed by a major party in Virginia, is still owed "a debt of gratitude," Crouch said, for taking on the well-financed Warner when no better-known Democratic Party member would run.

Gov. Charles S. Robb, widely popular in the state, did not express support for Harrison until the state convention. Since then, he has appeared at a variety of meetings for Harrison, but he has always described her campaign as an uphill battle.

Harrison has publicly complained at least once that Robb's weak support cost her $500,000 in lost contributions, leaving her struggling to get by on about $425,000 compared to $2 million for Warner. Robb's aides and other leading Democrats contend privately that the strong-willed Harrison became bogged down in staff upheavals and scheduling confusion that made it nearly impossible to work with her.

"It's reasonably clear that the governor and the top party leadership did not make an effort early enough to convince the public and the party that they were truly interested in defeating John Warner," said Ira M. Lechner of Arlington, vice chairman of the party for development and organization.

Other likely candidates for the Senate race were focusing on the 1985 statewide campaigns for governor, lieutenant governor and attorney general, despite polls showing that Warner, senator who squeaked to victory in 1978 by fewer than 4,700 votes, was vulnerable in 1984. Robb, who cannot succeed himself, ruled out running for the Senate seat despite strong pressure from state and national Democrats.

For any Democrat running, there was the difficulty of being on a liberal-leaning ticket led by Walter F. Mondale in a state overwhelmingly for President Reagan.

In addition, Warner had more than $1 million at the start of this year. He was prepared to spend part of his fortune, if necessary, to turn back what he had expected to be a challenge from Robb.

In the end, more than a dozen prominent Democrats decided not to run against Warner, a signal to those who usually raise money for the party that any campaign would be only a token effort.

Harrison, who had campaigned for more than a year with her only visible support from a few women's political groups, got the nomination by default at the party convention in June.

That inauspicious start was compounded by Harrison's quickly realized inability to rally Democratic Party leaders and workers to her campaign, in part because of her reputation as a combative maverick in the 1980-82 legislatures and her willingness to challenge party leaders, some of whom have not forgiven her.

That slow start dampened fund-raising even more, which enmeshed her campaign in a demoralizing cycle of bad publicity that further discouraged potential supporters and volunteers, various Democrats said.

A rally in her home town of Norfolk Thursday night, attended by Robb, drew about 150 persons in a theater with 1,736 seats.

Still, Harrison is keeping up a grueling campaign schedule right up to election night, when she will host a party in the Virginia Room of the John Marshall Hotel in Richmond. Party officials said she has continued through the sheer force of her personality, campaigning long hours and often driving where she cannot afford to fly.

"On the positive side," one adviser said, Harrison has shown she is "indefatigable, tough and knows the issues." But he said that was outweighed by her inability to "humble herself" to seek support from persons who have opposed her in the past, to raise money or to establish an organization.

Said one Democrat who has watched from the start, "She started with enthusiasm and ended up with enthusiasm, and nothing else."