A federal judge ruled yesterday that the American Pharmaceutical Association violated antitrust laws when it orchestrated a boycott against mail order prescription houses.

Judge Gerhard A. Gesell awarded $102,000 in damages to Federal Prescription Service, which has a plant and offices in Madrid, Iowa, for loss of profits between 1972 and 1977 as a result of the illegal activities.

Gesell said that the associations acitivities were "primarily economically motivated" and were "consciously designed to inhibit or prevent mail order competition for the benefit of its pharmacist members."

The Association, founded in 1852, has about 60,000 members nationwide and represents about one-third of all practicing pharmacists in the United States, Gesell said, As early as 1960, Gesell said, the association made clear its opposition to the distribution of prescription drugs through the mails. While the association claimed that mail order prescriptions threatened public safety and health, "these concerns in no way justified the generalized indiscriminate attack on all mail order pharmacies which occured," Gesell said.

Among other things, Gesell said, the associaion added to its code of ethic strict membership regulations aimed at mail order concerns, one of which set out a presumption that any pharmacist practicing with such firms was engaging in unethical conduct.

Partly as a result of the association's activities, many state associations, pharmacy boards and local governments either adopted the code or passed laws probibiting mail order practices, Gesell said.