William J. Schroeder, who became the world's second recipient of an artificial heart 18 days ago, tonight suffered a stroke in his hospital bed as he ate dinner with his wife, doctors reported.

Schroeder's life was not endangered, but his right side was partially paralyzed, Dr. Allan M. Lansing told reporters at a news conference four hours after the incident. Lansing said Schroeder had partially recovered and added, "I'm encouraged by that."

Lansing replied, "unequivocally, no," when asked if the stroke could have been a result of Schroeder's many activities recently. These included a telephone conversation with President Reagan Wednesday and fast government action earlier today to deliver a Social Security disability check that he had told Reagan was overdue.

At Humana Hospital-Audubon, where the implant took place, Lansing said Schroeder was talking with his wife when "she noticed suddenly he stopped feeding himself and was just holding his food in his right hand." He appeared "drowsy, his eyes rolled back, and he became somewhat limp," Lansing said.

The stroke was not "life threatening," Lansing said. Shortly afterward, Schroeder was somewhat "stuporous" and "not talking intelligently," Lansing said.

"His improvement has been steady over the last hour and a half, but only time will tell us whether that will continue all night or whether it will stop," Lansing said.

"He's alert, responds to questions, he does what you ask him to, at least as far as the left side of his body is concerned," Lansing said. He added that, when he left for the 10 p.m. news conference, Schroeder had fallen asleep. After the stroke, Lansing said, Schroeder underwent several tests, including a brain scan that showed no sign of hemorrhage but did suggest a stroke. Another test indicated that his brain waves were "fairly normal," Lansing said.

Lansing emphasized that the stroke was not due to any failure of the Jarvik-7 artificial heart's drive system or the heart itself. He said doctors are investigating three possible causes of the stroke.

These include the possible effect of Schroeder's diabetes on arterial disease involving small blood vessels in the brain, narrowing of the carotid artery in the neck for which Schroeder is expected to be tested Friday and a possible blood clot in the aorta or one of the heart's mechanical valves. The sudden onset of the episode might suggest a blood clot, Lansing said.

He said doctors determined that the stroke was not due to cerebral hemorrhage and gave Schroeder anti-coagulation medication and Decadron, a cortisone-like compound that reduces the possibility of swelling within the brain.

He was also given a diuretic to help his body discharge excess fluid, put back on an oxygen mask and was being given the protein albumin intravenously because his protein reserves were slightly below normal, Lansing said.

Within a few hours of the 6 p.m. stroke, Lansing said, Schroeder was able to recognize his wife Margaret and Lansing.

"At first, he was saying nothing. . . . now he is trying to make sounds," Lansing said, adding that Schroeder smiled when Lansing made a joking remark. Schroeder was returned to the cardiac-care unit from his transitional care room and was visited by his wife after being transferred.

The paralysis in Schroeder's right arm and leg appeared to be abating slightly tonight, and the right side of his face appeared less affected, Lansing said.

"With stimulus, he does move his right arm" slightly, Lansing said. "Such an early sign of recovery is encouraging."

Much earlier today, Schroeder had performed a feat that few strong-hearted Americans could match: He got the beleaguered Social Security system to deliver his disability check by special courier one day after he complained that it was overdue.

All it took was a complaint to Reagan.

This produced the following display of the government at work today: an early-morning White House call to acting Social Security commissioner Martha A. McSteen, calls from her staff to Social Security offices in three cities, a records-check by the Office of Personnel Management, a special order to the Treasury Department to print the check and a flight from Philadelphia to Louisville by a Social Security official to hand-deliver the check to the complainant.

"We got the proof right here that the buck stops here," the victorious Schroeder said from his hospital bed. The hospital videotaped the check-presentation and showed it later to reporters.

As he spoke, Schroeder waved the official brown Social Security envelope at the camera for emphasis.

He then took the hand of assistant district manager Cliff Burnstein, who was at his bedside for the presentation, placed it over his artificial heart, and said: "Thank you."

The story of how one artificial-heart patient defied the Social Security bureaucracy began Wednesday when Reagan called Schroeder to wish him well and was met with a blunt complaint about how "I'm just getting a runaround" on an application for disability benefits.

"I just called today and just keep on calling and keep on calling, and I don't get anywhere," Schroeder beefed to Reagan Wednesday.

Schroeder was forced to quit his job as a quality assurance specialist at an Army ammunitions facility earlier this year because of rapidly deteriorating health. He had applied for disability benefits last March.

Social Security judged in October that Schroeder was medically eligible for the benefits, but McSteen said his check would not have been issued for two more weeks had he not complained to the president. She said the government had to determine whether Schroeder was affected by a law reducing benefits for some federal pensioners. The Office of Personnel Management determined today that he was not.