Virginia Attorney General J. Marshall Coleman, who last year lost the gubernatorial race to Democrat Charles S. Robb, has rejected running for congress this fall, saying he has decided to join a small but prestigious Washington law firm.

Coleman, who will leave office Saturday, said today that he and his family plan to move to Northern Virginia, where he will remain active in Republican Party politics. But his decision to practice law, he said, does not "signal a permanent retreat from public life."

His decision to forgo another political race came as a surprise. The 39-year-old Coleman had been viewed by many party politicians as a good bet to succeed Rep. M. Caldwell Butler, who had announced shortly after Coleman's defeat that he would retire next year from his Roanoke-area House district.

A recent poll by Richard Wirthlin for the Republican National Committee showed Coleman with an overwhelming advantage in name identification among voters in the district, which includes Coleman's hometown of Staunton. Carroll Freeman, a Coleman supporter and former 6th District GOP chairman, said today that it had been "apparent that Marshall could win."

Coleman said, however, that his career has been divided between two pursuits: law and politics. For the present, he said, "I plan to pursue the law." He will be a general partner in the firm of Beveridge and Diamond, which was founded in 1974 by William Ruckelshaus, the former deputy U.S. attorney general and administrator of the Environmental Protection Agency.

Coleman's temporary exit from Virginia politics is likely to give state Sen. Ray L. Garland (R-Roanoke) the edge in the race for the Republican nomination in Butler's 6th District. Garland, who already has announced his candidacy, said yesterday that Coleman had solid support in the district and would have been "a formidable candidate."

Coleman said that he would not endorse any candidate in the GOP race, and predicted that it would be contested.

Coleman said that he and his wife, Niki, have not yet decided where in Washington's suburbs they will live. Their four-bedroom house in Richmond has been up for sale since last month.

Summing up his four-year term as Virginia's first Republican attorney general, Coleman cited his role helping to settle a prolonged federal desegregation suit over the state's predominately black state colleges and his defense of the state's right-to-work law. "I always sought to be the people's attorney," he said.

His last official press conference was a relaxed affair, interspersed with the quick jokes and banter that had been missing during much of last fall's campaign. Asked what his salary at the law firm would be, Coleman, who has served in both houses of the General Assembly, replied with a grin: "For the first time in 10 years, I don't have to answer that question."