There was an emotional moment in this small South African town today when Winnie Mandela, wife of the imprisoned leader of the country's main underground movement, met with the daughter of Atlanta Mayor Andrew Young and, ignoring the restriction orders against her, walked arm-in-arm through a milling crowd with the young American.

Under the orders that have restricted her for 23 years, Mandela may not be in the company of more than one other person at a time, and her impulsive act could mean a prison sentence of up to six months.

She seemed unconcerned about the possibility, however. "I was very touched by Andrea's reaction to me," she said afterward, referring to Young's 29-year-old daughter. "If they jail me for it, it will make little difference. After all, this place where I live is just a slightly larger prison."

The meeting took place when Young, who is accompanying Sen. Edward M. Kennedy (D-Mass.) and six members of the Kennedy family on an eight-day tour of South Africa, came to see Mandela in the shabby black ghetto outside the town of Brandfort to which she was banished eight years ago.

Kennedy, who is the most senior foreign politician to visit Mandela in her remote place of confinement, hoped also to visit her husband, Nelson Mandela, who has been in prison for 22 years, but tonight the South African government refused him permission to do so.

It was one of several signs of a hardening attitude toward the senator, who has been outspoken on several aspects of South Africa's segregationist policy called apartheid since he arrived last Saturday.

The Kennedy name still carries a good deal of awe in South Africa, and he is commonly referred to in the press here as a potential future president who would change the Reagan administration's policy of "constructive engagement" with this country into an attempt to produce reforms through punitive pressures.

The Kennedy visit is therefore bringing the American debate on apartheid into South Africa itself. This was strikingly illustrated yesterday when Kennedy and U.S. Ambassador Herman Nickel presented opposing views on economic sanctions at a lunch for businessmen, most of them white.

The visit to Winnie Mandela today revealed another facet of that debate. There is strong opposition to "constructive engagement" among black activists, who describe it as tacit support for apartheid, and many prominent blacks, including Winnie Mandela, have refused to meet with U.S. officials.

Mandela agreed readily to meet with Kennedy, however, although some members of more radical black groups have revealed a broader anti-Americanism by demonstrating against his visit on the grounds that it is "promoting capitalist interests."

For Mandela, the Kennedy visit was both a personal and political event of significance.

"I have always admired and identified with the family because they have suffered so much," she said in an interview. "We also know what they stand for, and for that reason our hopes lie in an administration such as the Kennedys of yesterday taking over that country."

When the Kennedy party arrived, Mandela, flanked by two daughters and five grandchildren in bright tribal outfits, embraced them warmly.

Her lawyer, who had flown from Johannesburg to supervise her observance of the restriction orders, then hurried her into the little three-room house in which she has lived since the white minority government banished her in 1976.

Kennedy entered the house and talked privately with Mandela for half an hour, while other members of his party chatted with her daughters in the tiny garden and about 300 reporters watched from the narrow dirt street.

The crowd surged forward as the two emerged from the house, and as Kennedy addressed the crowd, speaking of Mandela's courage and warmth, it became clear that the restriction order was about to be swamped. "I'll be making you all state witnesses and you'll have to come back for the case," Mandela joked.

Kathleen Kennedy-Townsend, a daughter of Robert Kennedy, presented Mandela with a replica of Robert Berks' bronze bust of her father. As the two women embraced, Mandela was heard to say: "Thank you, thank you so much. I am so deeply touched that I think if I had not shed all my tears long ago I would cry."

Overhearing this, Andrea Young, who was part of what had become a widening group gathered around Mandela, was moved to tears. Mandela turned to the younger girl to embrace her, then on impulse put an arm around Young and began walking with her through the milling crowd to the Kennedy motorcade parked down the dusty street.

"I told her that our liberation was their liberation too, all those whose roots are in Africa and all those who identify with our cause," Mandela said after the motorcade had gone and she had returned to her family, who also departed later, leaving her once again alone in her banishment.