The chief government prosecutor yesterday challenged a psychiatrist's claim that John W. Hinckley Jr. was driven by a suicidal impulse to shoot President Reagan, suggesting that if Hinckley had wanted to kill himself he could have done so without attacking the president.

If Hinckley's aim was his own death, Assistant U.S. Attorney Roger M. Adelman asked psychiatrist William T. Carpenter Jr., why didn't he shoot himself in his hotel room or go to the Washington Hilton Hotel, where Reagan was speaking, and "shoot the gun in the air and let the Secret Service take care of him?"

"If he wanted to commit suicide at the Hilton Hotel," the prosecutor continued, "couldn't he have gone up there with the toy gun later found in Hinckley's hotel room , pulled it out and let the Secret Service blow him away?"

Carpenter replied that Hinckley had tried unsuccessfully in the past to end his own life. By attempting to assassinate Reagan, he contended, Hinckley was trying to accomplish both the "termination of his own existence" and a "magical union" with the actress Jodie Foster.

In a full day of cross-examination, Adelman attempted through questioning to portray Hinckley as a calculating killer who carefully picked his ammunition, concealed his weapon so he wouldn't be stopped, and fired when he saw "the time was ripe."

Carpenter denied that Hinckley had gone through any such clear-cut process, testifying that he believed Hinckley "found himself at the impulse of that moment firing at President Reagan."

Carpenter also testified yesterday that he doesn't believe Hinckley was trying to hit each of the four persons he shot outside the Washington Hilton Hotel last March.

"I don't think he's certain what he shot at," he told Adelman.

Carpenter, basing his comments on what Hinckley told him in 45 hours of interviews after Hinckley's arrest, said Hinckley may have diverted his aim towards the presidential limousine at the last minute.

Under further questioning, Carpenter said he was not "trying to make a case that Mr. Hinckley didn't fire at the president." Carpenter said Hinckley told him that in the seconds before the shooting "the president was turning to smile at him but never had the chance . . . .

"He told me he seized the weapon, crouched, fired toward Reagan and emptied the weapon," Carpenter told the jury on the 10th day of testimony at Hinckley's trial.

Carpenter testified that he said in a report that Hinckley then "dropped the gun, fell to his knees and waited to be blasted."

Instead, Hinckley was quickly apprehended, offering no resistance, and charged with wounding Reagan, his press secretary, a U.S. Secret Service agent and a police officer.

Carpenter, the director of the Maryland Psychiatric Research Center, had testified earlier that he believes Hinckley suffers from a mental illness which he called "process schizophrenia," a break with reality that had its beginnings when Hinckley was a young adult, eventually developing into a serious mental disorder.

As a result of that mental illness, Carpenter said it was his opinion that Hinckley could not obey the law and could not appreciate that his acts were wrong.

While Hinckley had an "intellectual" understanding that his actions were illegal, Carpenter told the jury that the delusions and compulsions of Hinckley's "inner world" distorted his emotional understanding of the consequences of his acts.

Carpenter is the first of four psychiatric experts who will testify as defense lawyers try to persuade the jury that Hinckley was legally insane when he fired on Reagan. Prosecutors will present expert psychiatric testimony from three doctors to support their contention that Hinckley planned his acts and did not suffer from a serious mental illness at the time of the crime.

Adelman pointed out in questioning that Hinckley had been praised by his college teachers for some of his writings, that he had once held a job for five months, that he never demonstrated any "bizarre" behavior and had traveled extensively on his own around the country without trouble in the months before the shooting.

Carpenter testified, however, that such conduct is not inconsistent with his diagnosis that Hinckley suffered from a form of schizophrenia. People with such diagnoses "are perfectly capable of undertaking many coherent acts in their lives," Carpenter testified.

During cross-examination yesterday, Carpenter agreed that Hinckley had concealed his weapons and once destroyed a diary he kept while he stalked then-president Carter because he knew his actions were illegal.

In a "purely intellecutal sense Hinckley has always known that carrying a gun was wrong," Carpenter testified. But the psychiatrist denied that Hinckley decided not to shoot Carter because he knew it was wrong.

"He failed to carry it out because he was unable to get himself to do it," Carpenter testified.

Hinckley "had a history of impulses and hesitations," Carpenter testified and was "unable to get his behavior to culminate in his death."

"If he was driven to kill himself, why didn't he do it?" Adelman asked.

"People who are suicidal," Carpenter replied, "have many things that make them hesitate."