Virginia Attorney General Gerald L. Baliles' apparent victory in the Democratic contest for governor spells trouble for Republicans who say they fear he has revived the coalition of conservatives, blacks and liberals that elected Gov. Charles S. Robb in 1981.

"Baliles' candidacy is not going to be greeted with any great joy by Republicans," said Republican state Sen. Wiley F. Mitchell of Alexandria. Mitchell was one of many politicians surprised by Baliles' strong showing against Lt. Gov. Richard J. Davis in Monday's second and final round of delegate-selection caucuses.

David Doak, Robb's campaign manager and the chief consultant this year to Baliles, said today that the Baliles campaign was patterned after Robb's victory, which ended 12 years of Republican statehouse control in Richmond. "Virginia Democrats learned how to win in 1981 and they liked it," Doak said.

One key to Baliles' victory was his ability to seek out black, labor and liberal votes without alienating conservatives or being cast as a candidate of any one group or groups, party officials said. That problem had plagued Davis from the start and stemmed from his unsuccessful 1982 race for the U.S. Senate against Republican conservative Paul S. Trible.

Baliles "has tried very hard to emulate Robb," said Ed DeBolt, a veteran Republican political consultant from McLean who this year is handling the gubernatorial campaign of Wyatt B. Durrette.

DeBolt acknowledged many similarities between Robb and Baliles but said Baliles lacks "the charisma, the aura or personal magnetism" of Robb, the son-in-law of former president Lyndon Johnson.

Durrette last night scored a key tactical victory in his potentially divisive battle for the GOP nomination with Rep. Stan Parris, who was hoping to use Republican caucuses in Fairfax County as a springboard back into the GOP race in which he badly trailed Durrette. Although Parris won a majority of Fairfax delegates at the caucuses, he failed in an attempt to bind all of the county's 526 delegates to vote for him at the state GOP convention.

Both Republicans had fashioned their campaigns with sharp attacks on Davis, much like the rhetoric Republicans used in the 1970s in their campaigns against populist Henry E. Howell of Norfolk, who ran three times for governor.

This year Davis, 63, the former mayor of Portsmouth, was considered the front-runner in the Democratic race. After holding a 1,348-956 delegate lead in the Saturday night caucuses, he was swamped Monday night by Baliles' forces as they rolled up huge margins in mostly rural and suburban areas of the state.

Although the delegate counts were being disputed today by Davis' campaign, Baliles appeared certain to have at least the 1,803 delegates needed to claim the nomination at the party's June 7 convention in Richmond. Both Baliles and Davis were appealing today for support from about 187 officially uncommitted delegates elected at the caucuses and from the 97 Democratic members of the General Assembly who are automatic delegate to the convention.

At a press conference today, Davis asserted the contest was not over and promised to challenge as many as 200 of the 2,500 delegates chosen in the caucuses. "I'm in the race until the game is over . . . , " Davis said.

With Davis' lead of almost 400 votes after Saturday his aides had predicted victory, but their claim of adding another 472 "rock solid" delegates Monday fell far short. Davis won only about 230 more.

Many politicians said Davis cannot stop Baliles from winning the nomination and that despite his vow to stay in the race until the convention, they expect him to concede after reassessing his situation.

"It was a stunning showing," said poltical analyst Larry Sabato, a University of Virginia political scientist who had predicted a Davis victory. "Dick Davis was everybody's sentimental favorite, but they Democrats realized Baliles ideologically and temperamentally is better suited to the electorate," Sabato said.

Doak, Baliles' chief strategist, was credited with forging an informal coalition with blacks. Baliles himself stopped short of endorsing black state Sen. L. Douglas Wilder of Richmond, the unopposed Democratic candidate for lieutenant governor, but nonetheless won strong support from blacks. They earlier had been expected to give almost unanimous support to Davis.

"It's clear that one group is incapable of electing anyone to statewide office," said state Sen. Robert C. Scott (D-Newport News), who is black and supported Baliles despite strong ties to Davis.

Scott said the Baliles victory shows growing political sophistication of black voters across Virginia and their unwillingness to be tagged as supporters of any single candidate.

"You need a broad coalition of diverse interests," said Scott, who represents a 60 percent white district and said Baliles' victory also would help garner support for Wilder.

The Baliles victory also was a defeat for organized labor, which had endorsed Davis and worked for his support in the major urban areas of the state. Although a powerful part of the traditional Democratic coalition in other states, labor was a relatively minor factor in Robb's successive victories for lieutenant governor and governor.