John W. Hinckley Jr., apparently disturbed after hours of detailed testimony from a defense psychiatrist who contends Hinckley has a severe mental illness, was twice excused from the courtroom yesterday afternoon.

Earlier in the day, according to a transcript of the court proceedings, a deputy marshal had reported to Judge Barrington D. Parker that Hinckley "was a little restless and had voiced the opinion that he was just going to get up and walk out of the court proceedings."

As a result of that report, Parker called defense lawyer Vincent J. Fuller to the bench, and the two agreed that Hinckley would be allowed to leave the courtroom if he wanted to.

"I think that the testimony that he has been hearing the last two days has been very difficult for him. It is very personal to him," Fuller told Parker, describing Hinckley as "a very charged individual."

One source said Hinckley complained of feeling "uneasy" and was examined by the court nurse the first time he left the courtroom.

Hinckley made a dramatic and unexpected exit from his trial last week when actress Jodie Foster, testifying on videotape, said she didn't know Hinckley and had no relationship with him. Yesterday, Hinckley was excused once for about 20 minutes, returned to the courtroom after a recess, but was excused again for the remainder of the afternoon session, which continued for 25 more minutes.

The trial continued in his absence, but earlier in the day the proceedings were interrupted for about 90 minutes as a defense psychiatrist engaged in an angry dispute with the judge over restrictions on his testimony.

In a sharp exchange outside the hearing of the jury, Dr. David Michael Bear told Parker he could not "with my conscience" carry out his legal obligation as an expert witness unless he were allowed to testify about results of sophisticated brain scans performed on Hinckley, or at least tell the jury he had been barred from doing so.

He described the test results as a "very important piece of evidence."

Parker made a preliminary decision Tuesday not to allow testimony about the test results.

During a bench conference yesterday Parker, warning that Bear might be held in contempt of court if he refused to submit to cross-examination, told the lawyers: "I don't want this case to go up in smoke, but this man is not going to come in here . . . and twist things around as he wants to." He described Bear's demands as "amazing."

Eventually, after a private meeting with Hinckley's lawyers, Bear resumed his testimony. Later in the day, Parker indicated he will hold a further hearing on the disputed evidence, which the defense contends supports Bear's conclusion that Hinckley suffers from a form of schizophrenia, a severe mental illness commonly demonstrated by an extreme break with reality.

In a hearing Monday, defense lawyer Gregory B. Craig told Parker that computer-enhanced brain X-rays, known as CAT scans, show abnormalities in Hinckley's brain that studies have shown are found in patients diagnosed as schizophrenic. The prosecution opposes use of that evidence, contending that it has no accepted scientific basis.

Bear, 39, teaches at Harvard Medical School and is an internationally recognized expert in the relation between the brain and behavior. He was the second expert psychiatric witness called by Hinckley's lawyers in their effort to convince the jury that Hinckley was legally insane when he wounded Reagan, his press secretary, a U.S. Secret Service agent and a D.C. police officer.

Prosecutor Roger M. Adelman, in cross-examination, suggested Bear had relied primarily on interviews with Hinckley and had not pursued interviews with persons who saw Hinckley shortly before the shooting and on the day of the crime.

Bear, considerably more composed when he resumed his testimony, acknowledged that he had not talked to a former District medical examiner who saw Hinckley hours after the shooting. That examiner commented in a report: "This man is not depressed . . . I had no feeling this was a classical nut."

Bear, who has testified that Hinckley suffered from major depression, said "inaccurate observations" are commonly made even by persons who have seen patients over a long period of time.

Bear told Adelman he was "immediately horrified" when he saw in a report by prosecution psychiatrists that they had relied on interviews with observers at the scene of the shooting outside the Washington Hilton Hotel.

"Casual observers are a very poor source and indeed a treacherous source of information," Bear testified. He has repeatedly told the jury that Hinckley would appear "cool as a cucumber" despite his "inner rage," his depression and his fixation on fantasy ideas that guided his actions, particularly his delusions about a romantic union with Foster.

Bear told Adelman that "the facts are very clear" that a suburban Denver psychiatrist was wrong when he concluded that Hinckley was not seriously mentally ill in the months before the shooting.

"Nothing has been more painful to me than criticizing another doctor," Bear said. But, he said, "It is a psychiatric fact that his man was deeply psychotic."

Bear also told the jury that he believed that the government psychiatrist who was the first to examine Hinckley after the shooting, and who later conducted 55 interviews, also was wrong in her conclusion that Hinckley was not driven by deep delusions about the movie "Taxi Driver" and its main character Travis Bickle.

"The number of interviews is not a good test of whether the doctor probed the depth of the psychotic case," Bear testified about the report by Dr. Sally Johnson, who will be called to testify as a prosecution expert.

"In all humility . . . I believe she made an error," Bear said. "She did not see the depth of the thought disorder in this man."