The team, reporting in Science Translational Medicine, were analysing the billions of bugs that naturally call the human body home.
Their analysis of 319 children showed they were at higher risk of asthma if four types of bacteria were missing.
Experts said the “right bugs at the right time” could be the best way of preventing allergies and asthma.
In the body, bacteria, fungi and viruses outnumber human cells 10 to one, and this “microbiome” is thought to have a huge impact on health.
The team, at the University of British Columbia and the Children’s Hospital in Vancouver, compared the microbiome at three months and at one year with asthma risk at the age of three.
Children lacking four types of bacteria – Faecalibacterium, Lachnospira, Veillonella, and Rothia (Flvr) – at three months were at high risk of developing asthma at the age of three, based on wheeze and skin allergy tests.
The same effect was not noticed in the microbiome of one-year-olds, suggesting that the first few months of life are crucial.
Further experiments showed that giving the bacterial cocktail to previously germ-free mice reduced inflammation in the airways of their pups.
One of the researchers, Dr Stuart Turvey, said: “Our longer-term vision would be that children in early life could be supplemented with Flvr to look to prevent the ultimate development of asthma
“I want to emphasise that we are not ready for that yet, we know very little about these bacteria, [but] our ultimate vision of the future would be to prevent this disease.”
One explanation for the rise in asthma and allergies is the “hygiene hypothesis”, which suggests that children are no longer exposed to enough microbes to calibrate the immune system to tell the difference between friend and foe.
Giving birth by Caesarean section and not breast-feeding both limit the bacteria that are passed to a newborn. Antibiotics taken by a pregnant woman or newborn child can also change the microbiome.
Dr Brett Finlay, another researcher in the project, said: “[I was] surprised to realise that faecal microbes may be influencing things.
“What data’s really starting to show these days is that the immune system gets itself set up in the gut and influences how it works everywhere else in the body.”
Dr Benjamin Marsland, from the University of Lausanne, in Switzerland, told the BBC: “For a number of years, exposure to microbes has been linked with protection against asthma, a classic example is growing up on a farm and drinking raw milk.”
His own research suggests a high-fibre diet reduces inflammation in the lungs and may ease asthma symptoms.
He said previous research was showing a mounting role for diet, microbes and the first year of life being key.
He added: “This new study adds weight to these observations and supports the concept that there are certain developmental windows in early life, where it’s really important to get the right signals.
“A common factor in all studies so far has been the microbiota, in fact making sure babies have the right bugs, at the right time, might be the best step towards preventing asthma and allergies.”