Researchers said they are not yet ready to give up on the idea.
The study, published in Wednesday's Journal of the American Medical Association, involved 7,722 heart attack patients from North America, Europe, Argentina and India. Taking antibiotics failed to reduce their risk of death or further heart trouble over two years.
In recent years, some research has suggested that painless inflammation from such things as lingering respiratory or urinary infections or even chronic gum disease triggers heart attacks by contributing to the formation of clots in the blood vessels.
Smaller studies have suggested that antibiotics targeting such infections might reduce the risk of heart disease, and some doctors have begun to give heart patients antibiotics based on those findings.
The new study suggests that practice is premature, said Dr. Christopher O'Connor of Duke University, the lead author.
Still, his study suggests there may be some short-term benefits from antibiotic treatment as well as a slight reduction in heart trouble in patients with more than one risk factor, such as those who smoke and have diabetes.
And in an accompanying editorial, Drs. Sorin Pislaru of the Mayo Clinic and Frans Van de Werf of the University of Leuven in Belgium said different doses of antibiotics or different treatment schedules might still prove beneficial.
The study involved patients who had blood tests showing evidence of previous exposure to bacteria that can cause respiratory infections.
The patients took either azithromycin, sold as Zithromax, or dummy pills for 12 weeks. The antibiotic was started at a dose of 600 milligrams daily for three days, then weekly during the remainder of the study.
Azithromycin manufacturer Pfizer funded the study.
While early on there appeared to be slightly fewer deaths, recurrent heart attacks and heart-related hospitalizations in the antibiotic group, those differences disappeared over time. By about two years after the study began, more than 25 percent of patients in both groups had suffered such complications.
"We believe the jury is still out in terms of the overall question" of whether infection plays a role in heart disease, said Pfizer spokeswoman Mariann Caprino.
By Lindsey Tanner