NEW YORK, JAN. 5 -- An international tug of war for legal custody of an allegedly abused 9-year-old boy from Zimbabwe has pitted the Reagan administration against child welfare authorities here in a week of maneuvering in six state and federal courts.

The State and Justice departments, siding with the Zimbabwe government, have asked that the boy be returned to his country. But New York City welfare officials and the Legal Aid Society, fearing for the boy's safety, wish him to remain under the care of a foster family on Long Island until a petition to grant him asylum in the United States is reviewed.

The case of Terence Karamba, the son of an administrative attache with Zimbabwe's mission to the United Nations, has reached the 2nd U.S. Circuit Court of Appeals, which scheduled a hearing for Thursday. At the court's request, a temporary legal guardian was appointed today to represent the child's interests in the expectation that the case may be appealed to the U.S. Supreme Court.

The city's Human Resources Administration obtained a court order to place Karamba in foster care Dec. 11 after his teacher at a Queens public school reported that he was bloodied and bruised.

The city charged in court documents that his father, Floyd Karamba, "tied Terence's forearms and legs together with wire, and repeatedly struck him with an electrical extension cord." Some beatings allegedly occurred while the boy was suspended from pipes in the basement of the family's house in Jamaica, Queens, officials said. On one occasion, they said, Floyd Karamba untied the boy while he was suspended and let him drop to the floor, causing bruises on his face. According to the petition, his mother, Lydia Karamba, was aware of the beatings but took no action to protect the boy. The Karambas have two daughters, ages 3 and 6, who are in the custody of the Zimbabweans.

The case is unusual because of the allegations of abuse, but in some respects it resembles the frequent disputes over auto accidents and other mishaps in which the rights of victims in the United States clash with the privilege of diplomatic immunity.

"Our first concern is for the welfare of the boy, but that conflicts with our obligation to comply with international law" barring the detention of those with diplomatic status, a State Department official in Washington said.

In a preliminary court hearing this week, Assistant U.S. Attorney Igou M. Allbray argued that "Zimbabwe has asserted its right to this child . . . . Zimbabwe is angry and frustrated and is accusing this government of kidnaping the child."

"We are anxiously awaiting the release of the child," said Zimbabwe's charge d'affaires, Jonathan Wutawunashe. While declining to discuss placement for the boy, he said, "We are distressed that the child has not been released, but we have every expectation that the child will be returned."

The State Department ordered Floyd Karamba to return to Zimbabwe last week, citing unacceptable conduct.

"We were aware from the beginning that this was a complicated case," said Suzanne Trazoff, a spokeswoman for the city's Human Resources Administration. "But we did what we would do for any other abused child."

The government of Zimbabwe has given assurances that the boy will not be returned to his parents, but both the city and Legal Aid lawyers remain unconvinced.

Initially, said Trazoff, "All we wanted was time enough for him to prepare for going back {to Zimbabwe} so that there would be minimal psychological damage." But she said the city changed its position after the boy exhibited "extreme manifestations of fear on going back to Zimbabwe."

Legal Aid attorney Linda Fink said Terence Karamba "crawled into a cardboard box and rocked back and forth" when told of plans to send him home.

"This child is terrified of being turned over to anyone in the Zimbabwe government," she said. "He sees the government and his parents as one and the same. He has been examined psychologically several times and has had an extremely traumatized reaction to that idea."

Fink said she has been given "very vague assurances about alternate care for the boy" and remains concerned that he will be turned over to his parents.

The State Department official said its legal staff has not decided whether Terence Karamba's asylum request should render him a "defector," as would be the case when persons with diplomatic status seek asylum. International diplomatic rules do not apply to defectors. "The problem of asylum muddies the water," the official said.