A Montgomery County District Court judge decided yesterday to give Mary Thompson permanent custody of her 5-year-old son, Anthony, after the judge decided that there was not sufficient evidence to indicate that the mother had injected drugs into the child's arms.

"I feel great," Thompson beamed after the hearing. "I feel somebody lifted a ton off my chest."

D.C. law enforcement authorities placed the child in court custody on Nov. 20 after they contended that Anthony had unexplained traces of barbiturates in his blood and mysterious marks on his arms that might have been caused by insertion of needles. They accused Thompson of child neglect in a petition filed with the court.

Last week, D.C. officials -- who had learned about what they believed was possible neglect from the youngster's teachers in the District -- transferred the matter to Montgomery County because Thompson lives in Silver Spring.

Judge John C. Tracey yesterday dismissed the matter after listening to testimony from the boy's teacher, a D.C. General Hospital physician who treated the youth on the day he was placed in court custody, a retired toxicologist and Thompson.

Beryl Burns, the boy's teacher at Parkview Elementary School at Warder and Newton streets NW, said she brought the case to the attention of authorities after the child told her that a doctor had come to his house and stuck needles in his arms. She said he showed her the marks on his arms.

The school principal, fearing the marks may have come from drug injections, called city social workers, who in turn contacted the police. The police took the child to D.C. General Hospital.

Dr. Michel Young, a resident pediatrician at D.C. General Hospital, testified that the marks on the boy's left arm were "consistent with needle marks." However, she admitted under cross examination that the marks could have been made by a pin.

Young said tests showed high levels of two barbiturates in the child's blood -- amobarbital and secobarbital.

But Dr. Leo R. Goldbaum, a retired toxicologist, disputed the test results as being inconclusive. He said if the boy had such high levels of the barbiturates in his system, he would have been in a sleepy or nearly comatose state when he was examined in the hospital.

Young testified that the boy was quite active and alert when she examined him.

Thompson, 22, denied giving her son illegal drugs and said she did not know how barbiturates got into her son's blood system.

Near the end of the hearing, the judge placed Anthony in his lap and talked to him about school. Anthony told the judge he was going to go to school and study hard so he will be "rich" when he grows up.

Thompson voluntarily agreed to seek therapy for Anthony's hyperactiveness from the country's child protective services. She also said she would take her son out of the District school system and place him in a country school.

In an interview after the hearing, Thompson described the series of events that had led to her child being placed in court custody as "just crazy."

"If it had happened to somebody else," she said, "I would have thought it was crazy. You never think about it happening to you. When it hits home, it is frightening. Now I know how other people feel."

She said the whole matter could have been resolved on Nov. 20 when Anthony told his teacher the needle story if school officials had talked to her before calling the police.

"Nobody even bothered to ask whether 'T' [Anthony's nickname] was telling the truth," she said. "It was unfair. I hope other parents don't have to go through this. It's been a nightmare."