Veteran state Democratic legislators L. Cleves Manning of Portsmouth and Claude W. Anderson of Buckingham County were defeated in party primaries today, apparently setting the stage for a top level shakeup in control of the Virginia General Assembly.

The defeat of Manning, who was in line to become chairman of the powerful House Appropriations Committee, apparently means that the post will go to longtime Fairfax Del. Dorothy McDiarmid if she survives a Republican challenge in the fall.

Committee chairmen are chosen by the legislature's Democratic majority when the Assembly reconvenes in January.

Manning, who narrowly won reelection two years ago, was defeated by Kenneth Melvin, a Portsmouth lawyer, by less than 400 votes out of almost 8,000 cast. Manning had been in line to succeed Del. Richard M. Bagley of Hampton, who is resigning from the legislature to pursue his 1989 race for governor.

McDiarmid, a member of the House from Vienna who was first elected in 1960, is expected to give up her chairmanship of the Education Committee to take over Appropriations, considered the third most powerful job in state government behind the governor and speaker of the House.

Anderson, chairman of the influential Privileges and Elections Committee, was defeated by Watkins Abbitt Jr., son of former longtime 5th District Congressman Watkins Abbitt Sr. of Appomattox. Abbitt's victory margin was about 1,100 votes out of about 12,000 cast.

The race was characterized by whisper campaigns that drew widespread attention to the once politically allied families in the heart of Virginia west of Richmond. Abbitt faces Republican opposition in the fall.

Next line in seniority for the Privileges and Elections chairmanship is longtime delegate Hardaway Marks of Hopewell, who is not expected to give up his chairmanship of the Courts of Justice Committee.

That means the Privileges and Elections Committee, which controls Virginia's election laws, is likely to go to Del. Ford C. Quillen of Gate City, a member of the legislature since 1970.