The Montgomery County Council race has developed into a tangled web of alliances as 23 Democrats and 15 Republicans face an expensive and bitter primary that will whittle their number to seven nominees from each party.

The seven council incumbents, all Democrats, are seeking reelection, but they have divided into two warring camps. "United Democrats," headed by council president Neal Potter, backs County Executive Charles W. Gilchrist, who is also a Democrat. Council member Esther Gelman's "Merit Team" has made Gilchrist's administration its central campaign issue.

The two sides will run with full tickets of seven candidates, each having some incumbents and some newcomers.

And while the council was feuding, a third Democratic slate formed, made up of civic group leaders and community activists who claim they are fed up with the current council's internal warfare and "unresponsiveness" to citizens groups.

All of the candidates must run countywide, but five of them must live within the county's five councilmanic districts. The remaining two are true at-large seats. None of the incumbents will run against each other, and if voters split their choices between the slates, all the incumbents could be nominated.

Members of Potter's slate want to persuade voters that they are a complementary team that can work together and with Gilchrist, in sharp contrast to the past four years of bickering that have often led to long delays in decision making.

Potter's slate includes incumbents Ruth Spector, Scott Fosler and Rose Crenca, and newcomers Henry Heller, a former teacher's union president, Joan Hatfield, a lobbyist for the real estate industry, and Leonard Teitelbaum, a sewer commissioner and engineer.

Gelman's slate is trying to emphasize its "independence" from Gilchrist, and the "Merit Team" members like to refer to the Potter slate as the county executive's "Rubber Stamp" supporters. Besides Gelman, the slate includes incumbents David Scull and Michael Gudis, and newcomers William Hanna, the former Rockville mayor, Dr. Alfred Muller, who chairs the Friendship Heights Village Council, Jean Ross, board chairman of Montgomery College, and Thomas Israel, former school board member.

The third Democratic slate, the citizen's group, is still forming from among the nonaligned candidates. Already on that slate are Bethesda lawyer Phil Ochs, environmentalist and teacher Don Maxey, nurse Audrey Carpenter and Olney area community activist Carol Henry. Elvera Berson, a former president of the county's Civic Federation, may also join.

Allan S. Cohen, an educational consultant from Potomac who lives in the 2nd District, where Gelman also resides, said he was interviewed for a slot on the citizens' slate. Some Gelman supporters charge that Cohen is in the race at Gilchrist's request, to siphon off some of Gelman's Jewish support.

"I got a call from somebody saying Gilchrist would probably kiss me for running," Cohen said. But Cohen said he is running against Gelman, a former planning board member, because she is more interested in business development than neighborhood and community concerns. Hatfield, the "Merit Team" candidate in that district, has close ties to the real estate industry as a lobbyist for the Suburban Maryland Home Builders.

Although this year's primary campaign is not likely to reach the emotional fever-pitch of the 1960s and early '70s, the citizens' slate hopes to make development and planned growth a central issue by opposing all the incumbents but Fosler, who has close ties to civic groups.

Housing policy in the county is likely to be a key issue in the 5th District race in which Cathy Bernard, an outspoken member of the Housing Opportunities Commission, hopes to unseat incumbent Crenca. Bernard, who is running independent of any slate, has been sharply critical of Crenca's position on low-income housing in the county, accusing Crenca of delaying construction of such housing through her votes on the council.

In past county elections, bitter primary fights on the Democratic side have enabled Republicans to break the Democratic stranglehold on most local offices. But rather than looking with glee at the Democrats' troubles this year, the GOP is embroiled in its own internal battle, with the party deeply divided over its three candidates for county executive.

Del. Luiz R. Simmons, banker Joseph McGrath and Realtor John P. (Jack) Hewitt, a former Democrat, are in a three-way fight for the GOP nomination in a year when many Republicans believe incumbent Gilchrist is vulnerable.

Simmons, a moderate finishing his first term in the state House of Delegates, has alienated the party's small but vocal conservative faction. But the conservatives are split between the little-known McGrath and the more popular Hewitt, who switched to the GOP only in May.

The bloodletting for the executive nomination has spilled over into the council races.

Hewitt has chosen five running mates--an accountant, an investment counselor, a lawyer and two consultants--to form what he calls the slate to bring business-style management to Montgomery County.

In building his slate, Hewitt was looking for a quick show of legitimacy to keep his fledgling and underfunded campaign alive. But some GOP insiders believe that Hewitt, anxious for a show of momentum to quash rumors that he was about to withdraw from the race, may have formed his slate too quickly. It includes losing 1978 GOP county executive candidate Albert Ceccone, who has about as many enemies as friends among mainstream Republicans, and longtime conservative Malcolm Lawrence, whose opposition to sex education in the schools has alienated many moderates.

"Those people won't help Hewitt any," said a GOP moderate, who claims to be neutral in the race. "He might actually lose votes. Zero plus zero plus zero still equals zero."

McGrath, who has the financial support of many Montgomery businessmen and Republican conservatives, is waging an unexpectedly aggressive campaign. At least five of the GOP council candidates support him, including Alvin J. Arnett, a Conrail executive and well-known former Nixon administration official; Leonard Robinson, a research consultant; Sidney Overall, a retired Navy captain, and Jacqulyn Endres, a teacher and precinct worker.

Hewitt supporters will be pitted against McGrath backers in the at-large race and in the 1st and 5th districts.

Simmons, the third GOP county executive candidate, has said he would not form a slate and try to "force it down people's throats."