Two key groups within the American Bar Association have jointly recommended a standard that would sharply restrict the controversial "insanity defense" under which John W. Hinckley Jr. was found not guilty of the attempted assassination of President Reagan.

Their recommendation comes at a time when the Reagan administration, several members of Congress, psychiatric groups and legislators in at least 21 states have proposed ways to abolish or restrict the insanity defense. Their efforts to answer the public outcry that was spurred by the Hinckley verdict have set off a heated debate within the bar.

Next month at its mid-year meeting in New Orleans, the ABA's governing body will vote on the recommendation. If adopted by the full body as ABA policy, the recommendation would act as a model for states that are trying to amend their insanity-defense laws.

President Reagan sent a legislation draft to Congress last fall that would have abolished the defense as it was used in the Hinckley case. Though the administration's proposal was more restrictive than that of the ABA's Committee on Criminal Justice Standards and its Commission on the Mentally Disabled, Associate U.S. Attorney General Rudolph W. Giuliani said this week that the bar proposal is "a major improvement over the present law" in many states.

Currently the basic test used in 26 states, including Maryland and the District of Columbia, is two-pronged. A defendant may be found not guilty by reason of insanity if a mental disorder prevented him from appreciating that his acts were wrong, or if mental illness prevented him from controlling his behavior in accordance with the law.

The ABA committee recommendation would do away with that second condition, said Chicago lawyer Terence F. MacCarthy, who headed the ABA's special task force on the insanity defense.

Bruce J. Ennis, chairman of the ABA's Commission on the Mentally Disabled said the proposal "would authorize conviction of a person who knew that what he was doing was wrong, even if he argued that because of a mental illness he could not control his behavior or had an irresistible impulse" to commit the crime.

The basic question would be the "knowledge of wrongdoing," Ennis said. "In order to win an insanity defense you'd have to prove [the defendant] didn't know that what he was doing was wrong."

The two groups are recommending the change in ABA policy because they believe this narrower insanity test would provide a more objective basis to evaluate the psychiatric testimony given at trials, according to bar association documents.

The joint recommendation is certain to spur a heated debate when the ABA House of Delegates takes it up next month. Indeed, in making the recommendation, the Committee on Criminal Justice Standards rejected by a close vote the proposal of its special task force on the insanity defense, according to task force chairman MacCarthy. The committee and some task force members are meeting again this week in Clearwater, Fla., to discuss the proposals.

MacCarthy's task force had recommended that the ABA back the two-pronged insanity defense as it now stands because, "of everything we looked at we thought it was the best," MacCarthy said. His task force was one of several set up by the ABA in 1981 as part of an ongoing bar review of criminal justice standards.

Other sections of the ABA composed of defense lawyers and prosecutors already are opposing the committees' recommendation, attacking it from two directions. Prosecutors say the proposal does not go far enough in narrowing the insanity defense, while defense lawyers believe it is too restrictive.

The ABA recommendation "would result in a radical change in the law," says Gregory B. Craig, one of Hinckley's defense attorneys. "If adopted, [it] would sharply narrow the test for insanity."

Much of the argument between psychiatrists called by the defense and prosecution in the Hinckley case centered on the second prong of the insanity test: the issue of whether a mental illness prevented Hinckley from abiding by the law.

"The elimination of the second prong of the test would have had a drastic effect on the trial," according to one lawyer familiar with the case, who said that a tightened rule on insanity might have prevented the defense from introducing much of its important psychiatric testimony.

Giuliani of the Justice Department said the ABA approach would eliminate most of the insanity defenses that "the public feels are exaggerated"--cases in which the defendant maintains, "I knew what I was doing but I couldn't stop myself."

The proposed ABA change comes on the heels of similar proposals last week by the American Psychiatric Association to limit the insanity defense.

The ABA groups have made two related proposals. One suggests that jurisdictions that keep the two-pronged insanity defense shift the burden onto the defense to prove that the accused was insane. In jurisdictions using the narrower test, the burden of proof should be left with the prosecution.

The other opposes the enactment of laws that allow a verdict of "guilty but mentally ill." Eight states now have such laws, according to the ABA.