John W. Hinckley Jr. sat transfixed before a television monitor yesterday, watching, with the jury in his trial, the movie that psychiatrists say helped drive him to shoot President Reagan.

Hinckley, who told psychiatrists he had seen the two-hour film "Taxi Driver" as many as 18 times, stared intently as it played in the courtroom, clenching his fists during the shocking climax when the taxi driver, Travis Bickle, brutally slays three men in a bloody shootout.

Some of the jurors appeared repelled by graphic sex scenes that Bickle watched in pornographic movie houses. Otherwise, they watched attentively but with little reaction until the final scenes, when they, too, seemed gripped by the taxi driver's cold-blooded attack.

The movie was the last piece of evidence offered by Hinckley's lawyers in their effort to convince the jury that Hinckley was legally insane when he wounded Reagan and three others and should not be held criminally responsible for his acts.

When the film ended they rested their case. Hinckley did not speak in his own defense.

On Tuesday, prosecutors will begin their effort to convince the jury that Hinckley, while he may have been disturbed, coldly planned his attack on Reagan and should be held responsible for what he did.

Hinckley, who turns 27 years old today, turned his eyes away from the screen and shielded them with his hands yesterday during a scene in which a 12-year-old prostitute, whom Bickle had hoped to rescue from her sordid life, danced slowly and closely with her pimp as he tried to comfort her.

The prostitute was played by actress Jodie Foster, the woman the psychiatrists testified was the object of both Hinckley's love and hate. His obsessive desire for an eternal union with her and his own suicidal compulsions drove Hinckley to fire on Reagan, defense psychiatrists have testified.

Videotaped testimony from Foster was presented as part of Hinckley's defense, and he stormed out of the courtroom when she said on the tape that she had no relationship with him. It was confirmed yesterday that when her testimony was taped in March, Hinckley was taken from the courtroom after he threw a pen in Foster's direction and said, "Jodie, I'll kill you." The jury never saw that outburst, which was edited from the videotape.

Hinckley's parents, who have been present at the trial each day, also watched "Taxi Driver" yesterday. Hinckley's father had testified that his son never mentioned Foster or the movie to him and his mother testified that when Hinckley once asked her opinion of the film, she said she had never seen it.

As the movie played, Hinckley looked once quickly toward the spectators' gallery when Bickle, who by then had acquired a small arsenal of weapons, said: "This is a man who would not take it anymore. A man who stood up against the scum . . . "

Bickle, like Hinckley, stalked a presidential candidate. But in the film, as Bickle was about to draw his weapon and fire on the candidate, he was spotted by a Secret Service agent and fled. Defense experts have testified that Hinckley hoped he, like Bickle, would be stopped before he fired.

Although Hinckley knew at the moment that his act was illegal, the defense doctors said, he was driven to shoot by the emotional torment of his inner mind.

Hinckley, one defense expert said, "was much sicker than Bickle."

Defense psychiatrists have testified that there were scores of similarities between the movie character Bickle and Hinckley, who they said adopted pieces of numerous violent personalities in the months before he shot Reagan.

"Every story of a sick, bizarre character somehow entered this man's mind," Dr. David Michael Bear testified earlier in the trial. But like other witnesses, Bear said the "Taxi Driver" themes were the most persistent for Hinckley, who he said saw the lonely, rejected character of Travis Bickle and thought, "That's like me."

Hinckley bought the "Taxi Driver" script and could recite its dialogue, Bear said.

Hinckley mimicked even the smallest things that Travis Bickle did, Bear testified. He wore an army fatigue jacket and flannel shirts, drank peach brandy, took lots of pills, kept a daily log of his frustrations and eventually bought three guns as Bickle had. Like Bickle, Hinckley toyed with his guns while he watched television and practiced with them at a target range, Bear said.

Hinckley even concocted a girlfriend named "Lynn Collins" and wrote extensively about her to his parents, Bear said. The woman was modeled after a character named Betsey who rejected Bickle in the film, Bear told the jury.

Betsey worked for a presidential candidate in the movie, and Bickle began to stalk that candidate after being spurned by Betsey.

In a twisted ending to the film, Bickle's murderous attack on the young prostitute's pimp and two others is seen by the press and police as a heroic deed. The Foster character is sent home to her parents, who thank Bickle. Now sought after by Betsey, the woman who rejected him, Bickle coldly rebuffs her.

Psychiatrists have testified that Hinckley thought he, too, could win the attention of a woman--Foster--with violence.

The prosecution pointed out during Bear's cross-examination, and the jury saw yesterday, that there were also many differences between Hinckley and Bickle. While Bickle devoted himself to a physical fitness regime before he set out to assassinate the candidate, Hinckley was sickly, overweight, living on a diet of junk food and taking an assortment of prescription and over-the-counter medicines, according to testimony.

During questioning by the chief prosecutor, Roger M. Adelman, Bear also conceded that Hinckley did not use a holster, did not cut crosses into the tips of the bullets he used and did not shave his head into a Mohawk haircut as Bickle did.

Bear and two other defense psychiatrists testified that on the day he shot Reagan, Hinckley suffered from a form of schizophrenia, a severe break with reality characterized by bizarre fantasies, delusions and deep depression.

They and others told the jury that before Hinckley left the Park Central Hotel that day, he left an unmailed letter for Foster in which he said he hoped "by this historic deed" to win her respect and love. In "Taxi Driver," when Bickle set out to shoot the presidential candidate, he too left a letter behind, but with money in it, for the character played by Foster.

Yesterday, when the movie was done, Hinckley rubbed his eyes with his thumbs and then laid his chin on his hands folded on the defense table. He sat up for a moment to watch some of the credits roll by on the screen, but then leaned down on the table again, staring ahead, until deputy marshals led him away to the courthouse cellblock.