The first chapter in the most crowded congressional race in Maryland history will close out Tuesday when Prince George's County primary voters wade through a ballot overflowing with candidates and select two, a Democrat and a Republican, to run in a race for Congress this spring that many believe will serve as the first referendum on Reagan administration policies.

For the last month, 31 Democrats and Republicans -- including a young, wealthy political hustler, a former golden boy whose star has slightly dimmed, a defeated U.S. Senate candidate and the son and the husband of two of the country's most famous political personalities -- have bombarded Democratic and Republican voters in the 5th District with telephone calls, radio advertisements and literature.

In doing so, they have made this congressional primary possibly the most expensive in country history, with expenditures for all candidates expected to total $400,000 or more when time runs out Tuesday. That probable record will have been set in only five weeks -- the time since the unexpected decision by Congress to vacate Democratic Rep. Gladys Spellman's seat because of the stroke-like attack she suffered Oct. 31.

Despite the large financial investment of the candidates, election officials predict that the primary called by Maryland Gov. Harry Hughes for the sole purpose of filling Spellman's seal will bring out only 22 percent of the electorate or some 33,000 voters, roughly half the turnout of a regular election year primary. The 5th District, with its 106 precincts in northern Prince George's and six others in a sliver of Montgomery County, has 116,000 Democratic and 38,000 Republican voters.

The low turnout is expected in part because of the unusual timing of the special election and the speed with which it has been arranged, leaving many voters unaware that an election is on. But the lack of interest in the race is also a product of widespread confusion that the enormous field has caused.

As a result, the primary race for this federal office has become more of a contest of personalities -- who can get more voters to remember their name and location in the primary ballot lineup -- than a debate of issues and philosophy.

For the most part these dreamers and professional politicians are simply hoping to identify themselves as the rightful heir of Gladys Spellman and her near-legendary popularity in the country, often with remarkable convolutions of logic. "I think you find that my philosophy in most respects is very similary to Mrs. Spellman's," said John Eugene Sellner, whose conservative philosophies place him as far across the political spectrum from Spellman as possible. "Gladys has a lot of newly found disciples, no doubt about that," said her husband Reuben, a candidate in the race.

But, despite its resemblance to a personality contest, the primary has allowed two broad points to emerge: the Republcians in this primary are sticking close to President Reagan and hoping to coast into Congress on his platform; the Democrats, like their counterparts nationally, are careful to say they favor reducing taxes and the size of government but not at the expense of needed social programs.

With 19 Democrats and 12 Republicans in the primary, both parties are fielding candidates with a broad spectrum of political beliefs, stretching from a self-described progressive Republican "in the style of Teddy Roosevelt," who is consistently at odds with the current administration in the White House, to a law-and-order Democrat, consistently in agreement.

In between are the nine or so major candidates, defined as those who have raised enough money to print literature and fund telephone banks necessary to get their names out and have some chance of winning the primary. On several issues, these major Republican and Democratic candidates are in agreement: reductions in school aid to Prince George's, which has amounted to some $14 million a year in the past, are unacceptable; cuts in Metro funding of the 101-mile proposed subway system should not occur; elimination of the twice-a-year, cost-of-living raise for retired federal employes, many of whom live in the District, cannot be permitted.

But among the major candidates of each party, there are some carefully cultivated differences. On the Republican side, only three candidates -- Lawrence Hogan Jr., Audrey Scott and John Lillard III -- have emerged during the last month as serious contenders. All have allied themselves closely with Reagan, particularly his economic program, and insist that the country must have a Republican spokesman in Congress to be heard with the current administration . But they have also attempted to stake out some positions that separate them from one another.

Hogan Jr., the young son of the powerful Prince George's County executive, has tried to portray himself as the only candidate that would fully back the president's program. He supports a balanced budget, across the board cuts in taxes and spending cuts, elmination of the newly created federal Department of Education, tightening of welfare requirements and passage of an antiabortion amendment to the Constitution, among other issues.

Lillard has staked out the most conservative posture of the three major Republicans. At candidates' nights he has called the Panama Canal Treaties "sad history," says cuts in the student loan programs, used by many middle-class residents in the country, are justified ("Higher education is not a right. People who can't afford college should go into the Army and get an education."), and believes America must involve itself in other countries to protect its "own interests."

He has also waged the harshest radio advertisement campaign with scathing assault on his two opponents. Recent ads by Lillard charge improper "nepotism" in the selection of Hogan Jr. for a job in his father's county government and accuses Scott of being "pro-gay rights" and "pro-abortion," which Scott says she is not.

Both of Scott's opponents have attempted to label her a "crazy radical," according to her campaign manager, for her stances in favor of the Equal Rights Amendment and opposition to a constitutional prohibition of abortions. Scott has sought to counter these charges by stressing her support for increased defense spending -- but with monitoring of those expenditures -- tax cuts, and other fiscally conservative measures that would not unduly hurt poor and needy people.

She has also repeatedly noted her "record of constitutent services" as mayor of Bowie for six years. Scott has received the endorsements of most newspapers in the county as well as that of the two Baltimore dailies.

Of the other Republicans, only Jon Robinson has taken an approach critical of many Reagan proposals. He labels the president's across-the-board tax cuts inflationary, supports more environmental regulations and thinks curtailing federal student-loan programs would be a mistake.

Among the Democrats, only four candidates -- Stuart Bainum, Steny Hoyer, Sue Mills and Reuben Spellman -- have devoted much time or money to the race. Three other candidates -- Edward Conroy, Thomas O'Reilly and Francis White, all of whom reflect conservative philosophies -- have been politically active for years in the county and are therefore considered serious contenders for the seat. Bainum, a wealthy Montgomery County delegate who recently moved into the 5th District, has spent the most money and staked out the most liberal posture of the candidates. Bainum's campaign pitch has been to criticize Reagan's willingness to cut programs that help poor people while avoiding cuts in programs and subsidies that help corporation. Bainum oppose across-the-board tax cuts and favors registration of all guns and a moratorium on the construction of nuclear power plants, among other issues.

Although Bainum began this race as an unknown, his large expenditures on the campaign -- as much as $125,000 by primary day, a large portion of which will come from his own pocket -- have given him name recognition that could make him the "sleeper" candidate of the race. Bainum recently was endorsed by one of two countywide newspapers in Prince George's.

Hoyer, the former Maryland Senate president who was considered a likely prospect for the governor's mansion until he lost a race for lieutenant governor in 1978, has also positioned himself among the liberal side of the political spectrum. He has spoken out against Reagan proposals that would balance the budget and cut taxes at the expense of social programs.

Hoyer supports the continuation of the student-loan program, a strong defense that takes into account human rights policies of other countries and the SALT II agreement signed by former president Jimmy Carter to curtail the arms race. He also supports repealing the Hyde Amendment that restricts federal payments for abortion.

Throughout tghe campaign, Hoyer has attempted to emphasize his 12-year tenure in the state Senate and his ability to "effectively" represent the district. He has played down his past role as leader of the county's entrenched Democratic organization. Hoyer has received the endorsements of dozens of county and state labor unions and, recently, of two Baltimore newspapers and the Laurel News-Leader.

Sue Mills, a County Council member who established a name for herself in the early 1970s as a crusader against court-ordered busing, has taken a more conservative approach. She has also attempted to protray herself as the best candidate to guarantee effective constituent services to the district and has regularly charged that she is the only candidate not controlled by the new-defuct Democratic organization.

Mills supports many Reagan budget cuts, but is opposed to those that will hurt senior citizens, students and others able to demonstrate "true need." She supports a modified student-loan program, a stronger national defense, and is opposed to any cuts in NASA programs. She favors further research in nuclear power but believes strict controls over the nuclear waste must be put into effect.

Reuben Spellman, whose wife Gladys held the seat for which the candidates are now competing until she was stricken last year, was initially considered the leading candidate in the race because of his wife's strong support in the district. Having never served in public office before, he has campaigned on his wife's record, stressing that after 42 years of marriage, he is best equipped to carry out her wishes, constituent services and ideas.

As such, Spellman has also portrayed himself as a liberal like his wife and has repeatedly attacked Reagan administration proposals. Like his opponents, Spellman opposed across-the-board tax cuts and maintains that inflation must be brought under control by reducing the nation's dependency on foreign oil by relying more heavily on coal. Spellman supports a repeal of the Hyde Amendment banning federal funding of most abortions. He has been endorsed by one of two countywide newspapers in Prince George's.