Virginia Democratic Party Chairman Alan A. Diamonstein was among dozens of national party leaders in the Virgin Islands last weekend thrashing out, among other things, ways Democrats can shake their image as captives of special interests.

Maybe he should have stayed home.

Diamonstein returned Monday to find two of his party's leading contenders for governor in a political flap that reflects the party's national problem, a flap that some Democrats say may come back to haunt them in the 1985 governor's race against the Republicans.

At issue was the early state AFL-CIO endorsement of Democratic Lt. Gov. Richard J. Davis for governor.

The campaign of a Davis rival, Attorney General Gerald L. Baliles, lost no time charging that the endorsement by the AFL-CIO executive committee was part of a private commitment by Davis to support legislation allowing collective bargaining by public employes.

Davis fired back that the charge was a "damn lie" and threatened to withdraw as cosponsor of a February unity dinner with Baliles.

Diamonstein huddled with both sides and forged a truce before it got further out of hand. Davis' campaign said it would drop demands for an apology and Baliles said it was a time of unity.

To Davis' campaign, anxious to have the votes of union members who could make up about 500 of the 1,750 delegates needed at the party convention next June, the endorsement was key to his nomination strategy.

Davis, a mortgage banker from Portsmouth, is considered by Virginia standards to be the more liberal of his two opponents, Baliles and Del. Richard M. Bagley of Hampton.

Bagley stayed out of the tiff, a decision that could rebound in his favor should Davis falter and labor is unforgiving of Baliles' tactic.

Davis is busy trying to form a coalition of traditional party supporters, including teachers, blacks and labor leaders among others, to deliver the nomination.

But other Democrats are worried that the early endorsement was a painful reminder of the failed campaign of Democratic presidential nominee Walter F. Mondale.

Mondale got the national AFL-CIO endorsement in October 1983 and was promptly labeled the candidate of special interests by his party rivals. Republicans picked up the theme and used it against Mondale up to Election Day.

"We thought the Mondale precedent was not a very healthy one for rebuilding this party," said Darrell Martin, campaign manager for Baliles, who had not specifically asked for the labor endorsement but wanted the labor leaders to wait.

Martin, who sparked the intraparty fight by claiming Davis had made the secret pledge, said the endorsement of Davis showed a lack of a "realistic understanding" of the party's chances next year.

In Virginia, where only about 100,000 persons belong to unions, such a pledge by Davis would be extremely risky, if not fatal politically.

Still, if the goal was to tarnish Davis by reemphasizing his ties to labor, the Baliles campaign succeeded, at least in the short run.

The Republicans themselves picked up quickly on the theme.

Labor and the Democrats, said Republican Fairfax Del. Vincent Callahan, chairman of his party's house caucus, "were jumping in with a candidate who represents the ideals of Virginia to the same degree that Walter Mondale represents the ideals of the United States."

Callahan made the comments at a caucus meeting here Monday night where several Republicans said they believed Davis would be the easier candidate to defeat.

Although Baliles' campaign may have made its point, it is unclear how the controversy can be turned to his favor as the party heads into mass meetings next spring.

If Davis, considered the front-runner by many Democrats, were to stumble, it's unlikely labor would be anxious to turn to Baliles.

And that potentially leaves the real beneficiary Bagley, who had sought the labor endorsement. A Bagley spokesman, instead of complaining, said the campaign accepted the labor leaders' decision but would campaign individually for labor votes.

Bagley's decision drew no complaints from state AFL-CIO President David Laws, an ally of Davis. Laws had described criticism from Baliles and other Democrats as "labor bashing," a term used in describing labor's worst enemies.