A congressional hearing yesterday singled out Nicaragua as a mirror of the Carter administration's human rights policy and found that its reflections are causing confusion and unhappiness among both liberals and conservatives.

Sally Shelton, a deputy assistant secretary of state, testified that, in the year since Washington began prodding the Nicaraguan government, its human rights record has improved markedly. She also promised that future U.S. military aid will be linked to Nicaragua's rights performance.

However, Shelton's testimony ran into a crossfire of critcism. Rights activitists argued that the State Department has been too timid in dealing with Nicaragua, while supporters of the Nicaraguan government charged the administration with bullying a staunch, but defenseless, friend.

This testimony before a House International Relations subcommittee was notable because Nicaragua - an lowa-sized Central American republic of 2.2 million people - is among the handful of countries that have figured most prominently in the controversy over President Carter's championing of human rights.

For 42 years, Nicaragua has been controlled by the family of the current president, Anastasio Somoza. During most of that time, the Somozas enjoyed the strong backing of succesive U.S. government. Their chief instrument of power, the national guard, traditionally was trained and equipped by the United States.

That has long made Nicaragua a subject of controversial debate in U.S. diplomatic and political circles that outwardly seems out of proportion to its size and strategic importance.

Although U.S. liberals long have condemned Somoza as a tyrant, he has influential friends in Congress and elsewhere in Washington - a group referred to collectively by the anti-Somoza forces as "the Nicaragua lobby."

Under the Carter administration, the State Department increasingly has pressured Somoa to crack down on rights violations by the guard and ease his dictatorial rule. The pressure has included a freeze on arms transfers to Nicaragua and a cutback or postponemen of military and economic aid.

In her testimony, Shelton referred to a department report on human rights in Nicaragua, released last week, and said: "Although problems remain, it is our opinion that marked progress has been manifested since early 1977."

Since February of last year, she said, charges of serious rights violations by the national guard have decreased greatly. In addition, Shelton added the guard has behave "in a generally restrained manner" during the rioting, strikes and general unrest that have plagued Nicaragua since the Jan, 10 murder of Pedro Joaquin Chamorro, and opposition newspaper editor.

Shelton called attention to the clamps that have been put on military aid during recent months, and confirmed reports that the administration's fiscal 1979 foreign aid budget will, for the first time, contain no request for military sales credits to Nicaragua.

The fiscal 1978 aid budget provides $2.5 million to assist Nicaragua in purchases of U.S. military equipment and $600,000 for military training. By contrast, Shelton said, the 1979 budget request will ask for $150,000 in training grants.

Shelton's testimony about imporvements was challenged by the Rev. Miguel D'Escoto, a Maryknoll missionary priest and prominent Nicaraguan exile leader. He condemned the State Department's human rights report as a "whitewash," and accused the guard of continuing to carry out widespread murder, torture and rape during the past year.

D'Escoto and other rights activists were especially critical of the report's handling of events in Nicaragua since Chamorro's murder. He charged that, in recent days, at last 20 persons have been killed by the guard and that peaceful women demonstrators in Managua were beaten with metal chains wrapped in newspapers.

Washington, he said, should recongize that the current unrest represents a national repudiation of Somoza and cut off all military and economic aid to his government.

On the other side, Rep. Charles Wilson (D-Tex.), a leading congressional supporter of Somoza, charged the administration with following a double standard that subjects Nicaragua to whipping-boy treatment while continuing high levels of aid to strategically important allies like South Korea and Panama, despite their poor rigths records.

The subcommittee chairman, Rep. Donald M. Fraser (D-Minn.), also expressed skepticism about the administration's approach. When Shelton sought to justify military training assistance on the grounds that it give the United States influence over the Latin military, Fraser replied:

"Sometimes I think I'd like to have a job in the administration. Then, everytime I see a witness give an answer like that to justify a bad policy, I change my mind."