Terrence G. Johnson became temporarily insane when he realized he had shot a Prince George's County police officer last June, and cannot be held responsible for shooting a second officer, a psychiatrist testified yesterday.

Dr. Frances Welsing testified that Johnson's shooting of officer Albert M. Claggett IV on June 26 in the Hyattsville police station caused a "transient situational disturbance," a medical term for temporary insanity.

"he has no memory of shooting officer (James Brian) Swart, in fact he denies doing it," Welsing told a Circuit Court jury in Upper Marlboro.

"at the time that he shot Swart he lacked the capacity to understand the criminaltiy of his act," she said.

Welshing, who said she was asked to examine johnson by a group of black psychologists who felt a black could understand him better than a white, also said under cross-examination that if faced with the situation Johnson faced in the police station she might have acted the same way.

Asked by prosecutor Arthur A. Marshall Jr. if she could "justify" the two shootings, Welshing said, "I could justify them if I thought my life was in danger.

"terrence killed . . . under gross stress to his nervous system," Welsing said. "I would compare what happened to him to that of someone in combat who believes he is going to be killed."

Welshing was one of three witnesses called by the defense yesterday during the seventh day of the trial of th the 16-year-old Bladensburg youth accused of killing two police officers. Welsing's 41/2 hours on the witness stand preceded testimony by psychologist Charles Schwarzbec III and police spokesman John W. Hoxie.

Stalking up and down in front of the witness, prosecutor Marshall tried to get Welsing to portray herself to the jury not as a detached psychiatrist but as someone testifying in support of the defendant.

When Marshall asked if Welsing was aware of the results of examinations made by state psychiatrists, Welsing said, "Well, they're the state's psychiatrists and I'm the defense's psychatrist."

When Marshall asked Welsing if she thought that Johnson was "defending himself"-as she described it-when he swung a chair at Swart, Welsing answered yes.

"When someone kicks you in the groin, he is attacking your genitals," Welsing testified, "and when your genitals are being attacked, you have to defend yourself. Black people know about that."

Asked to explain further, Welsing said, "For a long time in the black culture the genitals have been considered extremely important to all males."

Under cross-examination, Welsing and said her analysis of Johnson's personality did not include interviews with his teachers or a review of his juvenile record, which included several assault charges.

Angrily, Marshall repeatedly asked Welshing why she took Johnson's version of the story as the truth when she had not talked to the police. Marshall's questioning became so antagonistic that Judge Jacob S. Levin warned him to stop, saying, "You can only do that (yell at the witness) on the television, Mr. Marshall."

Welsing also said under questioning that she believes Johnson should be released from custody at the end of the trial be given outpatient psychiatric treatment.

"He is still under tremendous stress," she said. "The only say to stop that stress is to put an end to the situation he is now in."

On several occasions Judge Levin directed Welsing to shorten her replies to questions. "You have gone on now for three minutes and you still haven't answered the question," Levin said at one point. "Is the answer yes or no?"

Welsing maintains a private practice in child psychiatry in Washington, where she has practiced since 1968. She is a graduate of Howard University.

Schwarzbeck, testifying after Welsing had resumed her seat with the Johnson family, said he believed Johnson suffers from a mental disorder known as "episodic discontrol."

"Under certain stressful circumstances his thinking tends to become disorganized," Schwarzbeck said. "In order to put his thinking back in order he often turns people into things. That helps him organize his thoughts.

Schwarzbeck said Johnson was most likely to become "disorganized" when he thought he was in physical danger-a situation like the one in the Hyattsville police station after Johnson and his brother Melvin had been arrested on suspicion of larceny.

Police spokesman Hoxie was called by defense lawyer R. Kenneth Mundy to demonstrate the differece between the version of events given by police in testimony last week and the version given the day of the incident.

Hoxie read from a police press release that said Claggett's gun was stolen by Johnson while Claggett was on the phone to Central Records. The release also said Calgett took Johnson into the fingerprinting room to be fingerprinted. The surviving officer who saw them enter the room testified that Claggett took Johnson in there "to calm him down," not to fingerprint him.

Hoxie said the rlease was based on information phoned to him from Hyattsville immediately after the shootings. He said there was no mention of Johnson's struggle with Swart in the proecessing room "because I did not become aware of it until the next day."

Mundy is expected to call one or two more witnesses this morning before resting his case. Marshall will then call rebuttal witnesses, including psychiatrists from Clifton T. Perkins state mental hospital.