Charles S. Robb and J. Marshall Coleman spent more than $5 million, a record amount for a Virginia campaign, in their contest for governor, which Coleman lost despite spending more than any previous gubernatorial candidate.

According to campaign finance reports filed today, Coleman, the Republican nominee, spent $2.8 million and still owes $485,000 to creditors. Robb reported spending nearly $2.4 million, more than twice that of any previous Democratic gubernatorial candidate, to become the first Democrat in 16 years to win the governorship.

Coleman, whose personal wealth is slight, has begun a direct mail campaign to supporters pleading for money to pay off the debt and reported collecting only $39,000 since election day. By contrast, Robb, a millionaire, has received $240,000 in contributions of $1,000 or more since election day, much of it from coal, real estate and other interest groups. Those donations enabled him to report a net surplus of $81,000.

Among the largest post-election donations to Robb were $62,500 from nine coal companies, each of which gave at least $5,000; $25,000 from Sydney and Frances Lewis and their Best Products Co. discount store chain; and $10,000 from the Virginia Education Association, the teachers' group which gave Robb no money before election day. The Best company also gave Coleman $10,000.

Robb, who benefited from the largest turnout of black voters in Virginia history, also reported spending $46,000 on a "voter contact" effort, most of it in the state's black precincts. The largest amount, $10,000 went to the Richmond Crusade for Voters, with the remainder of the money scattered among 52 clubs and political organizations.

Coleman's largest creditor is Richmond financier Lawrence Lewis Jr., close friend of Republican Gov. John N. Dalton and longtime GOP financial angel. Lewis underwrote $250,000 in loans to the Coleman campaign from United Virginia Bank and loaned $25,000 of his own money.

More than $100,000 is owed to various Coleman consultants for advertising expenses and polls. The campaign also owes $55,000 to William H. White Jr., a Richmond contractor. On Nov. 26, White made a $26,000 contributon to Coleman, in effect writing off that much of the remaining debt.

The largest other post-election contributions to Coleman were $5,000 each from E. Claiborne Robins Jr., Richmond pharmaceutical manufacturer; J. Smith Ferebee, Richmond financier, and Mr. and Mrs. C. F. Ehrenzeller of Virginia Beach. Dalton gave Coleman $1,000 on Nov. 19, for a total of $2,000 for the campaign.

The reports filed today cover campaign spending and fund-raising through the end of November. They indicate that Robb and Coleman's spending totals far eclipse those for previous campaigns. The previous record for gubernatorial campaigns was $1.9 million, which Dalton spent in defeating Democrat Henry Howell in 1977.

Coleman's defeated GOP running mates also remain in debt. State Sen. Nathan H. Miller spent $374,000 in the lieutenant governor's race, while receiving $219,000 in contributions. Most of the debt consists of $131,000 in loans Miller, a lawyer, made to his own campaign. GOP attorney general candidate Wyatt B. Durrette of Fairfax spent about $647,000 and reported a debt of $95,000.

Lt. Gov.-elect Richard J. Davis, a Democrat, spent $339,000 on his campaign and reported a debt of $125,000. Attorney General-elect Gerald L. Baliles of Richmond reported spending $380,000 and still owes $109,000.