When Harvard psychiatrist Park Elliott Dietz first heard that John W. Hinckley Jr. had shot President Reagan to get the attention of the actress Jodie Foster, he thought such a goal was "an odd and . . . crazy thing."

But Dietz told the jury at Hinckley's trial that after reviewing the facts and talking to Hinckley, he has decided "that goal makes sense."

Dietz's appearance on the witness marked a dramatic shift in the tone of the testimony at Hinckley's trial, which until that point had focused on the defense portrayal of Hinckley as a tormented man, driven out of control by suicidal impulses and his obsession with Foster, the unattainable object of his fantasies.

Dietz, however, quickly made it clear that he and other experts see logic--however twisted and improbable--in Hinckley's decision to attempt to kill Reagan outside the Washington Hilton Hotel on March 30, 1981.

The act had a dual goal, Dietz said. It was Hinckley's way of dramatizing his love for Foster and his anger that she had rejected him. And, Dietz said, it was an easy way for Hinckley to achieve the fame he was unwilling to work for, successfully launching himself into the history books with a single infamous act.

Defense psychiatrists had told the jury that Hinckley was driven by the "inner dictates of an inner world" when he fired on Reagan, that he was propelled by suicidal impulses and that he was consumed with an "internal frenzy" that may have been set off by extra doses of the tranquilizer Valium.

One said that John Hinckley saw the actress, Foster, as an "idealized mother figure," while another expert said that his responses to ink-blot tests were bizarre and full of signs of severe depression and that his scores on other tests put him in the category of severely ill persons in mental hospitals.

But according to Dietz, Hinckley's mental problems amounted to little more than a grandiose sense of self-importance--like that held by some actors, academics and doctors--along with the same blue moods felt by one out of every 10 to 20 Americans, from writers to air traffic controllers.

The defense says that Hinckley was "deeply psychotic." But Dietz, and another prosecution psychiatrist, Dr. Sally A.C. Johnson, have countered in their testimony that Hinckley never lost touch with his own identity and the realities around him.

Johnson, who agrees with Dietz that Hinckley suffered from personality disorders but not a serious mental illness, told the jury that while Hinckley was attracted to Foster, like a "super-fan," he never lost sight of the fact that he could never have a relationship with her. They have said he was bored, lonely, hopeless and a dawdler, but not seriously depressed.

The movie "Taxi Driver," which the jury watched one morning on television monitors, appealed to Hinckley--who saw the film about 16 times--but it was only a model for him, Johnson said. The defense experts had said the movie, in which the taxi driver attempts to assassinate a presidential candidate, had a profound influence on Hinckley, who saw his own lonely and dismal existence portrayed in the film.

The jury will choose between the two portraits.

More than 2,000 spectators have attended the Hinckley trial since it began in late April, not counting the press and VIPs. Many of them have been tourists. Tour buses have dropped off their charges at the courthouse door, and one day a guide, in full tour company uniform, came along with the crowd.

Patrick Devine of Lafayette, Ind., sat in the spectators gallery the other day with his four-year-old son Martin fast asleep in his lap. Devine, his wife Shary and their three boys had been to the Capitol and were on their way to the National Archives when they detoured into the federal courthouse for the Hinckley trial. They waited on line for a half hour, for a look at what they described as "history."

"I thought this was exciting . . . when they introduced evidence about Mr. Hinckley apparently stalking Jodie Foster . . . I thought it was neat I was there," said 14-year-old Matthew Devine, who explained he had been following the news about the case back in Lafayette.

"Yeah," interrupted his breathless 11-year-old brother Timothy.

John and JoAnn Hinckley of Evergreen, Colo. have attended their son's trial every day and are allowed to visit their son in the courthouse cellblock after 6 p.m. In court, Hinckley, seated with his lawyers at the defense table, rarely looks their way.

Bench conferences--private discussions between the judge and the lawyers--have constantly interrupted the trial. Transcripts of some of them (most have been sealed) reveal some candid commentary by Judge Barrington D. Parker.

"You know," he said in one private mini-lecture, "there is more to practicing law and trying a case before a jury than trying to get every ounce of evidence that is possible to get in, because you can get overkill, underkill and you can just . . . plain bore the jury to death."

At another point, there was a discussion at the bench about whether a homicide detective had "befriended" Hinckley on the night of the shooting.

"You know, police officers are riding in both directions. They either beat the devil out of the defendant or they act normal with him, and if they act normal with him they take advantage of him," Parker said, hastening to add, "I'm not commenting one way or another."

Chief prosecutor Roger M. Adelman and lead defense lawyer Vincent J. Fuller have had their share of exchanges. A recent one concerned Adelman's suspicion that Fuller might be planning to present more defense evidence after the government finishes its expert psychiatric testimony.

"He just thinks the worst of me, that's all," said Fuller to Parker.

"Only in court, Mr. Fuller," the prosecutor retorted.

The Hinckley press corps--about 40 reporters and sketch artists--has so far spent more than $3,500 to rent a copying machine and hire a "press room manager" to reproduce hundreds of pages of Hinckley's poems and writings that have been introduced at the trial. The press room, a dreary yellow place crammed with bodies, telephones, typewriters and electronic equipment, is now littered with Hinckley's literary efforts. On the walls are some amateur attempts by the reporters themselves.

The first day of trial, banquet tables covered with white cloths unexpectedly appeared in the press room, complete with silver platters of fresh danish, fancy urns of steaming coffee, china cups and saucers and two caterers to maintain decorum--all courtesy of Cable News Network. The next day, however--and ever since--it was back to styrofoam and cornflakes in the courthouse cafeteria.

A television correspondent organized a press field trip to see the movie "Taxi Driver," and many reporters sought out their own copies of a manual of psychiatric disorders that the prosecutor calls a cookbook on mental illness. As the trial lumbers on, the most sought-after member of the press corps has been the one with the chewing gum and mints that keep the tired troops awake in court.

Reports are that one of the Hinckley jurors postponed her wedding date--said to be mid-June--because the trial won't be finished in time. Otherwise, the jury of seven women and five men, and the six alternates, none of whom are sequestered, appear to have led a fairly quiet existence.

The deputy marshals pass them little paper cups of water during the testimony and Parker lets them stand up take a stretch once in a while. They eat lunch every day in a room in the basement of the courthouse and Parker has now decided he will let them walk outside afterwards--in the company of deputy marshals.

One day last week, a deputy marshal approached Parker at the bench. "Judge, one of the jurors feels like she's going to throw up," the marshal said. The jurors were excused temporarily, but all returned--without apparent distress.

So far, John Hinckley has heard his life story recited four times, by both of his parents as well as his brother and sister, and he has heard five psychiatrists and a psychologist analyze every turn he took from birth (uneventful), to his arrest for shooting the president, to his behavior in prison. He has appeared amused, restless, bored, angry and distracted. Of late, he has seemed infatuated with a blonde courtroom sketch artist, who stares at him continually through a pair of tiny binoculars.

Hinckley has been living in the courthouse cellblock since the trial began, where he has his guitar, writing materials and a black-and-white television set.

"He watches all the news," one source said.