A Baltimore doctor has invented a tiny electronic device that can be implanted in the body to combat a heart disorder that kills 300,000 Americans a year.

The new regulator, which gives the heart a series of small shocks to counteract ordinarily fatal rhythm disorders, has been used successfully in five patients since February by a Sinai Hospital-Johns Hopkins team.

The patients suffer from ventricular arrhytmias -- either fibrillations (irregular, uncoordinated heartbeats) or tachycardias (too rapid heartbeats).

"These patients ordinarily have a very poor prognosis" for life, the device's inventor, Dr. Michel Mirowski, said yesterday. Now, he said, these patients should "have an excellent chance to survive the attack and live to tell about it."

More than 100,000 Americans are being kept alive by implanted heart pacemakers electronic devices to control another common condition: heart "block" or slowed heartbeat. Soviet President Leonid I. Brezhnew is believed to be among the many persons who have internal pacemakers.

"What we think we have now," another doctor said yesterday, "is an internal electronic solution for still another major heart problem."

Mirowski and 10 colleagues reported their work in this week's New England Journal of Medicine. An editorial in the journal called the device a "potentially important therapeutic contribution" that may join drugs and, in some cases, surgery in controlling abnormally beating hearts.

Drugs should be tried first, doctors agree. Sometimes a surgeon can slice away the disordered part of the heart wall causing the problem.

The new alternative for the many patients who fail to respond to drugs -- or for whom surgery isn't the answer -- is a nine-ounce titanium device about the size of a package of cigarettes.

A slim cable, or "lead," from the divice is threaded through a neck artery into a major blood vessel leading from the heart. Another lead is inserted through the chest and attached to the heart.

The device is then buried under the skin of the abdomen, just below the rib cage.

In essence, it is a miniaturized version of the bulky electric defibrillators that provide the electric shock hospitals use to stabilize irregular hearts.

Because the new device is infernal, it uses only a small fraction of the voltage needed externally. The device automatically detects a rhythm disorder, waits 15 seconds to see if the heart corrects itself, then gives up to four shocks, if necessary.

The result has been extended life so far for five of six gravely ill patients, including a boy of 16. One patient died. The first patient, a 57-year-old woman, is alive and has been doing well, Mirowski said, since her implant last Feb. 4. The devices have detected and corrected nine dangerous arrhythmias, or disturbances in heart rhythm, in the patients.

Mirowski, a Polish-born heart specialist trained in France, Mexico, Israel and the United States, began work on his device the year before he came to Sinai Hospital 12 years ago.

"There were many problems," he said. But seven years ago a Pennsylvania firm, Medrad/Intec Systems, started working with him on a practical unit. Then doctors at Johns Hopkins, where he is an associate professor, joined him in the first human trial.

The heart has two halves, the auricle (or atrium), which sends used blood to the lungs for new oxygen, and the ventricle, which pumps oxygen-filled blood back to the body.

"Almost all life-threatening arrhythmiias are ventricular," Mirowski said. "Their outlook is so poor that of our first 10 candidates for treatment, four died before we could get them into Johns Hopkins Hospital."

The new device must pass further tests.

Johns Hopkins Applied Physics Laboratory scientists made a new portable monitor to tape the new device's responses and heart action during the trials. Patients in the study wear it on the belt or on a cord around the neck. But it shouldn't be needed in regular medical use.