D.C. elections officials said yesterday that a significant number of the special challenged ballots cast in last Tuesday's primary election are in the two wards where the City Council races were the closest and that these ballots could change the outcome of those elections.

Of the 23,000 special ballots cast, 6,327 -- just over one-fourth of the total -- are from Wards 1 and 5, where the elections were tight. Special ballots accounted for 35 percent of the votes cast in Ward 1. In Ward 5 they accounted for 25 percent of the vote.

The closest of the two elections is in Ward 5 in upper Northeast, where civic activist Robert I. Artisst was trailing incumbent council member William R. Spaulding by 579 votes when all the regular ballots were counted early Wednesday morning.

In Ward 1, near downtown in Northwest, school board member Frank Smith Jr. was leading housing activist Marie Nahikian by 742 votes.

The D.C. Board of Elections and Ethics yesterday validated all but 40 of the 2,887 special ballots cast in Ward 1. Election officials hope to validate the Ward 5 special ballots and to count the special ballots from both Wards 1 and 5 on Monday.

Elections board chairman Albert J. Beveridge III said he expects the validation and tabulation for all wards to be finished by Friday.

The announcement of the distribution of the special ballots buoyed the hopes of some candidates who are in second place.

However, special ballots generally reflect the distribution of votes cast by regular ballot. For example, in the 1978 D.C. mayoral election, approximately 7,000 votes had to be tabulated manually -- about 2,000 special ballots and the rest ballots that the computer was unable to read. When these votes were counted, the percentages of votes held by Marion Barry, Sterling Tucker and Walter Washington remained the same.

Artisst, who so far has received 3,973 votes to Spaulding's 4,552 and is winning in five precincts, compared with Spaulding's nine, pinned his hopes in part on Precincts 66 and 71, which have a large number of special ballots.

He said that in Precinct 66 in Michigan Park, where he trails Spaulding by only five votes, there are 405 challenged ballots to be counted. In Precinct 71 in Woodridge he is behind by about 56 votes, and there are 517 challenged ballots.

Meanwhile, strategists for Nahikian took a conservative view of her chances of winning a come-from-behind victory over Smith, predicting instead that she would come within 300 votes of Smith. If that occurs, they said, they would request a recount.

Jimmie L. Jones, Nahikian's campaign manager, said that he expects her to increase the lead she has in the six precincts where she now is winning and reverse the trend in three precincts where she is behind by less than 15 votes. All but one of those precincts are in Adams Morgan and Mount Pleasant, where there are 1,800 special ballots.

Workers for both Artisst and Nahikian said that no matter what the outcome after the special ballots are tallied, they will consider taking legal action against the board of elections over the handling of the primary.

Both candidates alleged that poll workers for various candidates were seen filling out ballots on behalf of people who could not read the ballots or for various reasons were unable to go inside the polling place and vote for themselves.

They also said they were concerned that the names of thousands of legitimately registered voters apparently were dropped from the voter rolls, forcing those individuals to vote by special challenged ballot.

Mayor Marion Barry said he was disturbed by the number of special ballots: about 17 percent of the 121,000 votes cast. But he praised the overall performance of the elections board under its new executive director, Teddy Filosofos.

The elections board, meanwhile, issued a public statement yesterday apologizing to voters for any inconvenience they may have experienced in last Tuesday's election and promising that the problems would be cleared up before the general elections on Nov. 2.