Government prosecutors yesterday portrayed John Warnock Hinckley Jr. to a federal jury as a calculating and practiced gunman who coldly stalked one president, then attempted to kill another.

Hinckley's defense lawyer countered that portrait with his own account of a young loner, withdrawn from the real world and driven by unattainable fantasies to fire the shots that wounded President Reagan and three others more than a year ago.

"The more isolated, the more withdrawn, the more alienated, the more hopeless, the more helpless, the more depressed Mr. Hinckley got, the crazier the fantasies became," defense lawyer Vincent J. Fuller said in his opening statement yesterday, the first day of testimony in Hinckley's trial on charges of attempting to assassinate Reagan.

He said Hinckley nurtured "magical" notions about his own abilities, trying to pursue a Hollywood career as a musician and imagining himself the head of what he called the "World Front Organization."

The final fantasy, Fuller said, a product of the 26-year-old college dropout's obsessive but frustrated love for the actress Jodie Foster, led Hinckley to the Washington Hilton Hotel on March 30, 1981, where President Reagan was giving a speech.

"We all know what happened after that," Fuller said.

Hinckley contends he was legally insane when he shot Reagan, his press secretary James Brady, U.S. Secret Service Agent Timothy McCarthy and D.C. police officer Thomas K. Delahanty.

The prosecution, aiming to prove that Hinckley's attack was a deliberate and premeditated act, presented testimony from nine witnesses and other evidence about his actions before the shooting, including two incidents in which he appeared to be stalking President Carter.

Prosecutors showed the jury a videotape of a 1980 Carter campaign appearance in Dayton, Ohio, in which a man identified as Hinckley is seen in the crowd about six feet from Carter.

Fuller disclosed that Hinckley twice considered suicide before he attacked Reagan. In the fall of 1980, Fuller said Hinckley took an overdose of prescription drugs. After the killing of singer John Lennon, Fuller said Hinckley began to see himself as Mark Chapman, Lennon's murderer.

On Feb. 14, 1981, Fuller said, Hinckley, with a gun in his pocket, stood outside the New York apartment house where Lennon was killed "and tried to destroy himself but couldn't bring himself to do it."

In his opening statement, Fuller said Hinckley saw a Colorodo psychiatrist at least a dozen times between October 1980 and February 1981 and told him about his obsession with Foster, but the doctor did not "probe into the existence of mental illness in Mr. Hinckley."

Meanwhile, Fuller said, Hinckley continued his travels, stalking Reagan in November and December in Washington. Fuller said Hinckley once considered assassinating Foster, fantasizing that they would be "bonded together in life by their mutual joint deaths."

Hinckley's father, who had consulted with the psychiatrist, set a March 1 deadline for his son to be "out of the family home, independent and self-supporting," Fuller said. Young Hinckley was still drifting when the deadline passed, Fuller said, so his father, a Denver oil executive, gave his son a few hundred dollars, and the younger Hinckley began living in motels in Colorado.

"The last line of reality has been severed because his parents have sent him out," Fuller told the jury. Hinckley was "left to his fantasies," Fuller said. After another unsuccessful trip to Hollywood, Fuller said, Hinckley "thinks . . . Jodie Foster is my real love. I'm going to go back to pursue that."

By bus, Hinckley arrived in Washington, where he resurrected the distorted success of Travis Bickle in the film "Taxi Driver," which Hinckley had seen at least 15 times since 1976, Fuller said. Bickle stalks a presidential candidate, befriends a young prostitute played by Foster, and in a twisted ending, becomes a hero when he kills several men, including the girl's pimp.

Hinckley left a note to Foster in his hotel room before he set out for the Hilton, Fuller said, and explains "that what he is about to do is done out of love for her."

After the prosecution completes presentation of its evidence, Hinckley's lawyers will begin presentation of the insanity defense, relying on expert psychiatric testimony. The prosecution will then present its expert testimony in an effort to prove that Hinckley was sane when he shot the president.

In his opening statement yesterday, Assistant U.S. Attorney Roger M. Adelman described the scene at the Hilton, depicted in a photograph taken by the hotel's security director and shown to the jury yesterday. The picture, Adelman said, shows about 20 to 25 people waiting for the president to arrive, "just ordinary folks," conventioneers and tourists.

"There is one other man in the picture who is waiting. This gentleman right here, John Hinckley Jr.," Adelman said, pointing to Hinckley, who was seated at the defense table in the well of the courtroom. Hinckley quickly looked up and then turned his eyes away from the prosecutor.

"He is waiting. Oh, he is waiting to see the president you will see. He is waiting with a gun in his pocket.. . . He is waiting to shoot the president. He is waiting to kill him."

Crouched down in what a police witness later described as a "combat position," with a .22-caliber revolver clasped with both hands, Hinckley began to fire as Reagan emerged from the hotel's VIP entrance, Adelman told the jurors.

The first shot struck the head of press secretary Brady, who almost fell onto Hinckley as he dropped to the ground severely wounded, Adelman said.

Police officer Delahanty, who was standing nearby, took the second shot, Adelman said. Delahanty, who retired from the force on disability after the shooting, testified later in the day that he heard a single shot, followed by four or five more "in rapid succession."

"Mr. Hinckley, in effect cleared a path between him and the president with the first two shots," Adelman told the jurors.

The third shot went over Reagan's head and struck a building across the street. Hinckley, still crouched down, moved the weapon from left to right, Adelman said.

"He tracked the president of the United States with a pistol," Adelman said. The fourth shot from Hinckley's pistol, a "Saturday night special," struck Secret Service agent McCarthy.

"All of a sudden I heard gunshots," McCarthy testified yesterday. As he placed himself between the president and "the apparent danger," McCarthy testified, "I was hit by a gunshot . . . . at that point I fell to the ground and realized the confusion that was going on around me."

The fifth shot hit the presidential limousine, Adelman told the jurors.

The sixth and final shot from Hinckley's gun richocheted off the car "directly into the chest of the president of the United States," Adelman said. The bullet lodged near Reagan's heart.

In a network videotape of the shooting, Adelman told the jurors, they will see Hinckley's hands pulling the trigger. "Indeed, it appears. . . . that he is pulling the trigger after the sixth shot is fired," Adelman said. The jurors are expected to see the film today.

During yesterday's prosecution testimony, a Lubbock, Tex., pawnshop manager told the jury that in June 1980 he sold Hinckley a box of Devastator bullets, which have tips that explode into metal fragments on impact. When Hinckley fired at the president, his gun was fully loaded with Devastator bullets, prosecutor Adelman told the jury.

Later in the day, the owner of the Foothills Shooting Center in Lakewood, Colo., located near Hinckley's family home in suburban Denver, testified that Hinckley had been to a target-shooting range there in December 1980 and January 1981. Targets confiscated from Hinckley's home were introduced into evidence, including two silhouettes of a man, full of bullet holes.

A former patrolman at the Nashville, Tenn., airport, John Lynch, also testified yesterday that he had stopped Hinckley there in October 1980 as he attempted to board an airplane with a .38-caliber revolver, two .22-caliber revolvers, a box of ammunition and handcuffs in his luggage. According to the testimony, President Carter was in Nashville that day for a campaign appearance.

Hinckley's defense lawyers had few if any questions for the prosecution witnesses yesterday. In his opening statement, Fuller said the defense case will rest on testimony from Hinckley's family, medical doctors and psychiatrists who have examined him.

The mentally ill can "plan, premeditate some of the most bizarre kind of activities . . . . that is the case in this instance," Fuller told the jurors.

The question in Hinckley's case, Fuller said, is "what does it all mean?"