John B. Anderson filed his first formal request today to be placed on a state ballot as an independent candidate for president and promptly ran into the realities of the two-party system.

The filing itself was easy enough. Anderson simply handed A. James Manchin, West Virginia's colorful secretary of state, a "declaration of candidacy" for the "Independents for Anderson Party."

Manchin, a publicity-hungry Democrat, greeted the Illinois Republican and his entourage with open arms. He appointed Anderson a West Virginia "ambassador of good will," decorated him with a medallion bearing the state motto, "Mountaineers will always be free, and decreed, "You are hereby commanded to speak only good will of the mountains and valleys of West Virginia.

"There's room in this state for all divergences of opinion," Manchin said. "We welcome everyone."

Then he added, with a sly grin, "Congressman, West Virginia cries out for $2,000."

Anderson handed him a check for $2,000 -- his second check for that amount here this year. The first was to get his name on the Republican primary ballot while he was still running for the GOP nomination.

But even after the $4,000 investment, Anderson has a long way to go to get on the West Virginia ballot. At a noon rally opening his campaign here, Anderson state coordinator Michael Fulda, a political science professor, told the audience:

"West Virginia prides itself in having one of the most difficult election laws for third-party candidates in the country. The laws were written at the time of the First World War to keep socialists, progressives and other undesirables off the ballot."

The laws require independent candidates to obtain signatures from 7,510 voters by June 2. In itself, this doesn't sound like much, but there are a couple of catches. First, petition-gatherers must register at county courthouses and can only circulate petitions in their own magisterial districts. More damaging to Anderson, people who sign the petitions forfeit their right to vote in the June 2 Democratic and Republican primaries.

Besides West Virginia's four congressional seats, scores of patronage-rich county offices are being filled this fall. "It's a real interesting political year in this state," said Anderson supporter Scott Scobell. "People have to decide what's more important, local or national races. Most people in West Virginia side with the local races."

Anderson is facing similar battles around the country as he tries to get on the ballot in as many states as possible. It's a battle against time, a battle of lawyers, not voters. To wage it, his campaign has hired one of Washington's most prestigious law firms, Arnold and Porter, and is replacing conventional political workers with a team of 10 young attorneys.

On paper, the fight seems easy enough. Anderson has missed filing deadlines in only five states -- Kentucky, New Mexico, Ohio Maine and Maryland. Technically he needs 873,092 signatures to get on the ballots of the 45 other states and the District of Columbia.

But state laws are a maze of inconsistencies. Each state has a different set of rules and reqiurements. In Iowa, which requires only 1,000 signatures, it's relatively easy to get on the ballot. Others, like North Carolina which requires 166,377 signatures, make it nearly impossible.

Anderson anticipates major challenges to his petitions, chiefly from Carter reelection forces, and is digging in for a long fight.

Meanwhile he is racing the clock. He has been an independent less than a week, and ballot-filing deadlines are fast upon him.