John W. Hinckley Jr., accused of the attempted assassination of President Reagan, was seriously ill but improving slowly yesterday after attempting to hang himself Sunday in his cell at the Fort Meade stockade, the Justice Department reported.

The 26-year-old Hinckley, with a makeshift jacket noose still around his neck after one of its sleeves was cut loose from a window bar, lay semiconscious for 30 minutes on the floor of his cell while base firemen struggled to slice through the jammed lock on his door.

Hinckley apparently stuffed cardboard from a box of crackers into the lock and managed to keep his guards at bay outside his cell as he began his second unsuccessful attempt to take his own life since his arrest last March 30.

Hinckley is in the intensive care unit at the Fort Meade base hospital. Justice said tests will be conducted to determine if Hinckley suffered brain damage from loss of oxygen during the three to five minutes that he hung from his cell window.

Hinckley "is expected to recover but it is not possible at this time to determine if any permanent neurological defects will result," Justice said.

Hinckley's recuperation from his suicide attempt could delay the start of his trial, now scheduled for Jan. 4. His defense lawyers could ask the court to have Hinckley examined a second time to determine if he is mentally competent to stand trial and assist in his defense. Hinckley has admitted that he shot Reagan and three others, but claims that he was insane at the time he did it.

Senior inspectors from the U.S. Marshals Service, assigned to guard Hinckley, shouted frantically at him as they saw him stand on top of a chair on his bunk and then tie one arm of an Army field jacket around an iron window bar and slip his head through a noose that he had fashioned from the rest of the jacket, Justice Department spokesman Tom DeCair said in a prepared statement.

Hinckley "then hung himself," the statement said. The inspectors, who have had Hinckley under a 24-hour suicide watch that includes closed-circuit television surveillance of his cell, soon discovered that the cell door lock was jammed.

Marshals Insp. Ed Popil ran to the cellblock kitchen and grabbed a butcher knife while Insp. Roger Mullis rushed to an exercise yard outside Hinckley's cell, the statement said. Mullis turned a weightlifting table on its side to reach the window to Hinckley's cell 10 feet above the ground. Mullis then climbed on the table, opened the unlocked window, reached through and cut the arm to the jacket that held Hinckley suspended several feet off the cell floor, the statement said.

Hinckley dropped to the bed but his neck, with the noose still knotted around it, was draped across the arm of a chair, DeCair said. To make sure that Hinckley could breathe, DeCair said Popil and Mullis stuck a broom through the cell door window to push the bed away so that Hinckley's body rolled to the floor and lay flat.

The incident occurred about 5 p.m. Sunday, apparently as the inspectors were changing shifts. DeCair said that Hinckley may have jammed the lock while the inspector on duty was admitting his replacement. DeCair said the door lock may also be out of the line of vision of the closed-circuit television monitor on Hinckley's cell.

Inspectors and firemen reached Hinckley 30 minutes later after using a hydraulic bolt cutter to get into the cell. Sources said Hinckley appeared blue and was thrashing about on the floor, both of which are signs of an acute loss of oxygen.

He was taken by ambulance to the emergency room at Kimbrough Army Community Hospital on the Fort Meade grounds at 5:48 p.m.

Justice's statement said that in the emergency room, Hinckley "was not fully conscious, was physically agitated and reacted poorly to stimuli." Hinckley was breathing on his own, the statement said, and was immediately treated with oxygen and intravenous medications to reverse the effects of the oxygen loss. The immediate impact of the oxygen loss was corrected, the statement said.

A tube was placed down his throat to assist his breathing, the statement said. He was placed in the intensive care unit and his "consciousness continued to improve" through the night.

As of yesterday morning, the statement said, Hinckley was still "seriously ill" but slowly improving and was responding to commands with eye and muscle movements. There was some evidence of injury to Hinckley's neck muscles and he is receiving treatment for possible complications, including kidney problems, that could follow, according to the statement.

One neurosurgeon, informed of the Justice Department's account of Hinckley's medical condition, said that he believed that Hinckley would continue to improve, particularly since there was no evidence of neck injury or other trauma and the fact that he was responding to simple verbal commands. The surgeon, who emphasized that he had not examined Hinckley, said that the bulkiness of the jacket Hinckley used as a noose probably prevented serious injury.

DeCair said that he could not comment on whether Hinckley had left a note explaining his reasons for the attempted suicide.

On May 27, Hinckley ingested an overdose of the aspirin substitute Tylenol, and possibly tablets of the tranquilizer Valium while he was confined at the federal correctional institute at Butner, N.C.

Hinckley, who had been undergoing extensive psychiatric examinations at Butner, apparently had secretly saved up the pills by pretending to swallow them when they were administered by prison officials. Since his arrival at Butner, Hinckley routinely requested medicine for headaches.

Hinckley, who confessed to a psychiatrist that he had taken the overdose, was rushed to the prison medical unit and was given an antidote. He was described at all times as "ambulatory and coherent," the Justice Department said at the time.