Medicines given to babies for acid reflux or heartburn could raise their risk of allergies later in life.
These drugs more than double the risk of developing food allergies, particularly to cow's milk, a study of almost 800,000 children found.
Meanwhile, children given antibiotics in early infancy see their chances of getting asthma rise twofold.
Acid-suppressing drugs and antibiotics are linked to allergies including hayfever and eczema in the research, which suggests these medications may disrupt the normal balance of healthy bacteria in a child's gut.
The gut is important in developing a healthy immune system which will not overreact to food or grass pollen.
Researchers led by the Uniformed Services University of the Health Sciences in Maryland analysed 792,130 children. About one in six were given an antibiotic in their first six months, while almost one in ten received a drug to tackle heartburn and acid reflux.
The results showed the acid drugs more than doubled a child's odds of allergies to foods including peanuts and eggs.
These drugs, called H2RAs and PPIs, also raised the risk of a medication allergy by 70 % and the chances of a child getting hayfever by 50 %.
Antibiotics more than doubled babies' chances of getting asthma in childhood and of developing an allergy to cow's milk or egg.
The risk of allergies rose if children took the drugs for longer. This was the case for children given acid-suppressing medications for more than 60 days and those who took antibiotics for more than ten days.
The authors state: ‘While there has been increasing recognition of the potential risks of antibiotic use during infancy, H2RAs and PPIs are considered to be safe and are commonly prescribed for children younger than one year.
‘These medications are frequently given to infants who regurgitate food and appear to be fussy. For most infants, however, regurgitation of gastric contents is not a disease, but rather is a developmentally normal process.'
The NHS says reflux, when a baby brings up milk during or soon after feeding, is normal and not a cause for concern in a healthy child. Where it is a problem, PPIs – proton pump inhibitors – and H2RAs – H2-receptor agonists – can be used to reduce the level of acid in the stomach so the contents do not irritate the baby's gullet.
The US study found 7.6 % of the military babies monitored received H2RA drugs before six months of age, with 1.7 per cent being given PPI drugs.
Apart from food allergies they were most likely to get medication allergies and anaphylaxis – a life-threatening reaction to an allergy which makes it hard to breathe.
The largest risk for asthma came from antibiotics, of which penicillin is most commonly given to young children.
Babies given these drugs almost doubled their risk of asthma, while PPIs raised the risk by 41 % and H2RAs by a quarter.
The study, in JAMA Pediatrics, concludes: ‘Acid-suppressive medications and antibiotics should be used during infancy only in situations of clear clinical benefit.'