The D.C. City Council, reversing a position it took last November, voted yesterday to repeal an 8 percent tax on candy, soft drinks, chewing gum and confections, with several members saying the tax was confusing and unenforceable.

"The tax was a horrible mistake," said council member John A. Wilson (D-Ward 2), who first proposed the tax. "It's too difficult to figure out . . . and we have never been able to identify how much revenue" the tax has raised since it took effect in September 1980.

Wilson proposed last May that the tax be repealed, after receiving a letter from House Speaker Thomas P. (Tip) O'Neill urging the action. O'Neill noted that he represented an area of Massachusetts where several candy companies were located. Wilson said he has not discussed the tax with O'Neill, and received no further correspondence from him.

The council refused to repeal the tax last November, voting in a 6-to-6 tie with one absence. Yesterday, the council voted 10 to 3 to repeal the tax.

The tax was supposed to bring in $500,000 in annual revenue, but city officials said they did not keep separate sales tax records on how much money has been collected under the measure.

Council members said yesterday the tax resulted in confusing rules governing what foods containing sugar could be taxed--such as hard candy and fudge--and what others could not, including cookies, sherbets and packaged cereals.

Wilson and other council members said small businesses and grocers in the city have complained that the tax was a burden for small shops that had to identify hundreds of similar items that may or may not be taxed.

In addition, the council had been lobbied by the National Confectioners Association, a group of candy manufacturers, which complained that the tax was not fairly applied to all competitive foods containing sugar. Most food is not assessed sales tax in the District, except for a 2 percent tax on vending machines, an 8 percent restaurant tax, and the now-doomed candy tax.

Wilson, chairman of the council's finance and revenue committee, acknowledged yesterday that "It was a ridiculous tax." He said it was introduced in 1980 as an alternative to an increase in the gasoline tax. "To tell you the truth, we did it in a hurry," Wilson said, without considering its long-range enforcement effects.

Wilson said he brought up the repeal yesterday "because we had the votes." Several council members suggested the repeal was an easy vote during this election year since the revenue loss was minimal and it would please a lot of small businessmen. "I get a lot of work done in a political year," said Wilson.

Council members John Ray (D-At Large) and David A. Clarke (D-Ward 1), both of whom voted to keep the tax last fall, said they voted to repeal the measure yesterday as a personal favor to Wilson. Ray also said small businessmen had complained the tax was too complex.

Council members Jerry A. Moore Jr. (R-At Large), who voted last fall to repeal the tax, and Hilda Mason (Statehood-At Large) and Charlene Drew Jarvis (D-Ward 4) voted yesterday to keep the tax in place.

"The problem is not the law," said Mason, "the problem is how it's implemented." Moore agreed, suggesting the city could clearly define what should be covered by the law. He said if the council "gets into the business of repealing" laws that are difficult to administer, "we wouldn't have many laws left."

Mason, calling herself "a real health advocate," said in an interview that repealing the tax would probably reduce the price of candies and make them more available to children. "I'm opposed to encouraging them to eat junk," she said. She voted against the repeal last fall.

"The purpose of the tax was not to ban sugar . . . ," Wilson countered. "It was to balance the budget--and it wasn't needed." Wilson was referring indirectly to the city's fiscal 1981 audit that showed the city with a $68.3 million surplus.