Declaring that "the Bear is back," White House press secretary James S. Brady left the hospital yesterday, 239 days after an attempted presidential assassination left him near death with a bullet in his head.

Demonstrating the dramatic progress he has made since then, Brady walked slowly but triumphantly out of the main entrance of George Washington University Hospital, leaning on a metal crutch in his right hand and guided by the physical therapist who has worked with him daily in recent months.

The faint scars of several operations crossed Brady's balding head, and his left arm, still paralyzed by the injury, was supported by a sling.

But his obviously high spirits were reflected in a colorful outfit of kelly green sweater and blue-and-green plaid pants.

By his side was his smiling wife, Sarah, dressed in matching clothes and a pin that showed a bear reading a newspaper with the headline, "The Bear Is Back," a reference to Brady's nickname.

Neurosurgeon Arthur Kobrine, who performed the life-saving brain surgery after the March 30 shooting and has attended him ever since, shook Brady's hand as he was helped into a wheelchair and lifted into a specially equipped van that carried him home to Arlington.

Although Brady did not speak during his emotional exit, he greeted reporters, the cheering crowd and the 72-piece Washington-Lee High School Generals' Band--which played a rousing version of "When Irish Eyes are Smiling" and the University of Illinois fight song--with a thumb's-up signal of appreciation.

And, appropriately, White House aides distributed a "statement by the press secretary," Brady's first press release since the shooting.

Calling it a "special day," he said he was "saddened" to say goodbye to the hospital staff "whose dedication, competence and refusal to give up have made today possible."

Brady also offered a "sincere thank you to so many wonderful people throughout the country and around the globe. Your prayers and words of support and encouragement were the greatest source of strength and courage I have ever known."

The 41-year-old press secretary said that "we rejoin our friends and neighbors with a true spirit of optimism for the future. They say, 'The bear will be back.' I am here to say, 'The bear is back.' "

Brady was the most seriously injured of the four victims struck by gunfire at the Washington Hilton.

President Reagan earlier recovered from a wound in his chest.

The fact that Brady survived a major bullet wound in his head was called a miracle by some.

At the time, neurosurgeon Kobrine called it "extraordinary," in the sense of "out of the ordinary. Only one out of 10 victims survive."

In an interview yesterday, Kobrine used the same adjective to describe Brady's "courage" and "perserverance" during the long months since the shooting, a period plagued by additional operations, a bout with pneumonia, an epileptic-type seizure and the difficult business of rehabilitation.

He predicted that Brady would continue to make physical progress in coming months, walking more easily with a cane by spring.

As to his patient's mental recovery, the doctor concluded that his "intellectual capacity is fine." He said Brady's emotional control continues to improve, a problem commonly suffered by victims of injury to the right side of the brain.

Brady, for the next several months, will return to the hospital five days a week for 4-hour sessions of physical, occupational and speech therapy. Kobrine said yesterday it is "too early" to predict when Brady might work again, but that eventually he could go back to an "intellectual white-collar" job.