Indira Gandhi left Britain yesterday after a week-long visit that saw her hounded by cries of "Naiz" and "dictator" from immigrant neighborhoods to the House of Commons.

The former Indian prime minister, whose political disgrace in March 1977 was salvaged somewhat by a parliamentary by-election victory a week ago, was pummeled at every turn by questions about the 20 months of emergency rule that eventually ended her 11-year hold on the prime minister's office.

Gandhi was at times defiant and at times defensive, but throughout her stay she served notice that she intends to give Prime Minister Morarji Desai no quarter.

She was greeted on her arrival at Heathrow Airport a week ago by hundreds of demonstrators shouting slogans both for and against her. She had to be whisked away through a cargo tunnel.

It was a scene that was to be repeated of throughout her stay.

One night she was spattered with an egg and shortly afterwards booed from a stage where she was trying to address Indian workers in London's predominantly Indian Southall district.

A meeting with students turned into a shouting match. Members of the staid Cambridge Union chartered buses to come to London after Gandhi had told them she did not have time to go to Cambridge. Meeting in the House of Commons, the students pummelled her with questions about the 20-month emergency that ended her 11-year rule.

After 20 minutes of increasingly hostile questioning, Gandhi cut short the meeting and stalked out. As she left Indian members of the union continued to hurl pointed questions to her in Hind.

Gandhi came to power in 1966. Nine years later when her bid to remain in power was threatened by charges of election fraud, she imposed "emergency" rule with disruption of civil liberties, press censorship and enforced sterilization, among its many excese. She was forced from office in a general election in 1977.

Her visit to London officially was to join Indians here in celebrating the 89th birthday of her father, Jawaharlal Nehru. Most observers gree, however, that she has been conducting a public relations tour, both to ride on the crest of her electoral success and to build up favorable international sentiment prior to facing charges later this month on charges of corruption arising from the time of the emergency.

On Saturday, a speech to Indians gathered at a movie theater in Birmingham was marred when demonstrators outside blocked her motorcade and threw bottles.

Inside, the bottles were replaced by rose petals and Gandhi told the cheering crowd of about 2,000 that it was the Indians shouting slogans against her who were the "fascist." In turn, she described herself a "servant of the people."

Meetings with the press were filled with questions she understandingly might preferred to ignore.

Was there not evidence of repression and outright dictatorship when she was prime minister?

There was an "emergency," she replied.

Were not thousands of people killed and imprisoned during the emergency"

"Far more people have lost their lives, property and jobs since the new government took," Gandhi stated unflinchingly. "Most of the people who were arrested or lost anything during my government were certainly guilty of something."

Asked whether she felt any guilt about the forced sterilizations during the emergency, she replied simply that "I have been in favor of compulsion in this or any other matter. There were some incidents of forcible sterilization, it is true. But nothing like what was advertised or reported in the press."

And as to press censorship, "We did not beat about the bush. We had censorship to meet a particular situation. It was temporary. It went on much longer than we had planned."

Should she return to the office of prime minister, would she condone censorship again?

"No, we won't have censorship again. But there must be some kind of code of conduct. As for the press in my country at this moment, there are pressures on it today from this government. People are sent for and threatened in one way or another. Government advertising has been withdrawn from various journals."

Gandhi's visit postel ticklish diplomatic problems for British leaders. On the one hand, the Indian ambassador, Narayan Gnesh Gory, refused to greet her when she arrived, following the ruling Janata Party's charge that the trip was for propaganda. On the other, following her surprising resurrection into public office after her election victory last week, British officials were reluctant to snub a possible future head of state.

Prime Minister James Callaghan and opposition leader Margaret Thatcher each arranged private half-hour visits with her, as did former conservative prime minister Edward Health.

Time and again she was asked whether she would seek to be prime minister again.

"No," she said in Frankfurt, while en route to Britain. "No," she said at Heathrow upon arriving. ""No," she said to various press conferences, meetings, and after dinner gatherings.

Nonetheless, she was full of dire predictions that the Janata government would fall within a year. And at one press briefing she did reveal that she and her associates have evolved "20-point plan to help the poorest, the common man, with land reforms, debt relief and so on. But the Janata Party has put things into reverse in the past two years. Some of the things that have been going on are truly horrible, just horrifying."

Gandhi continued her populist call even at a posh dinner sponsored by the Indo-British Association - an affair which critics complained cost as much for each meal as some Indian farmers earn in three months.

"If the poor feel the system is not meeting their needs," she said in a tired, but deliberate voice, "will they tolerate the system?"

"We believe in democracy," she went on, "but what is it that matters? Is it the voice of the people? Or the privilege of the few."

Outside the banquet where she was speaking, a young girl silently held a placard which asked: "Mrs. Gandhi, in the emergency, who killed my uncle?"