IT COMES and goes, and yesterday it disappeared in Virginia after a threatening onslaught: the Democratic Party Affliction, a chronic, debilitating political disease characterized by internal fractures and aggravated lesions. Until party leaders reached a settlement that will give the nomination for governor to Gerald L. Baliles, it had looked as if a clean and classy battle between him and Richard J. Davis would degenerate into a bitter and crippling series of delegate challenges at convention time in June. But now the party has agreed on its ticket for the fall, and apparently all factions are satisfied with the arrangements.

In the center of the negotiations throughout was the life of the party for the past four years in the state, Gov. Charles Robb, who understandably would like his legacy to include a strong Democratic Party that continues to hold the top three jobs in Richmond.

Mr. Baliles, the state attorney general, had appeared to have the delegates to win the nomination anyway. But Mr. Davis, the lieutenant governor, was challenging the election of hundreds of Baliles delegates and seemed to have a clear majority on the temporary credentials committee assigned by the party to review those challenges. In turn, there was a challenge to the challenge: Mr. Baliles was contending that the credentials committee has been improperly chosen. In effect, Mr. Davis acknowledged he would have had to prove he had not lost.

But had all this dragged out much longer, the loser even before the general election campaign might well have been the party. While the Republicans still haven't ironed out all differences between apparent winner Wyatt B. Durrette and Stan Parris, the GOP tends to recover from these things a lot more quickly.

For Democrats who have come to enjoy the perquisites of control in Richmond and who shuddered at the thought of a suicidal convention, the agreement is the best of intraparty worlds. It is not victory, though, and surely the Republicans are not about to toss in the towel just because the Democrats managed to avoid defeating themselves.