The District of Columbia's long-running struggle with its voter rolls took another twist yesterday as city officials discovered that scores of residents whose ballots were disqualified were in fact registered and should have had their votes counted.

Elections board chairman Albert J. Beveridge III said the number of mistakes on the list of rejected ballots was high enough that he would ask the board to authorize a recheck of the entire list of disqualified voters.

Over the past week, the board formally has notified 5,017 persons who voted in the Sept. 14 primary that their ballots would not be counted. Only about 150 of those voters have called to challenge the board's action, but elections officials said yesterday nearly every one of those who called was found to be properly registered when records were rechecked. They could not provide an exact count.

Beveridge has said he expects several hundred of the disqualified ballots to be counted eventually. Rechecking the list would delay certification of the results, but is not expected to affect the results of the primary races.

He said he would ask for a complete review of the list today during a special elections board meeting called to name a temporary successor to outgoing elections executive director Teddy Filosofos.

Filosofos confirmed yesterday that he will resign Thursday, as he announced last week, despite strong appeals from the board and Mayor Marion Barry. Barry met twice yesterday with Filosofos, who said he was leaving because of political interference in his handling of the primary and because it would take at least another 18 months to resolve the problems of the elections apparatus.

"My gut feeling tells me to go. It just tells me to go," said Filosofos, who is returning to his former position as Democratic deputy commissioner of elections in Erie County, N.Y, a job that pays $20,000 a year less than his $50,000 salary here.

Meanwhile yesterday, Philip Ogilvie, a former elections board consultant who until last week was directing voter registration efforts for Barry's reelection campaign, said he has been asked by the mayor to recommend long-range solutions to the board's staffing problems.

Ogilvie, who left the campaign to take a city post as aide to Dwight S. Cropp, Barry's executive secretary, said he would not be involved in the efforts to run the elections office before the Nov. 2 general election.

The elections board has been struggling for months to straighten out the city's voter registration rolls. Despite a substantial effort this summer to insure a complete and up-to-date list, about 23,000 voters were forced to cast special challenged ballots in the Sept. 14 primary because their names did not appear on voter lists at precincts.

By law, those challenged ballots were checked against the election board's voter registration card files, the only legal record of registered voters. That check produced the list of 5,017 disqualified voters, each of whom was sent a new application and a notice that their disqualification could be appealed.

Elections officials said a small number of names that do not appear in the card files do show up on computerized voter registration lists. Those names can be counted if the people appealing can prove they have a registration card or know their registration number, they said.

Some voters who appealed their disqualification were found to have valid registration cards on file, while others were on the computer list and were able to produce a registration card or number.

Today is the last day that voters who were disqualified can appeal the elections board's ruling by either telephoning the board's office (347-6041) or by appearing in person at the elections office in the District Building.