Low rates of allergy are observed in children growing up on a farm, but the factors that contribute to this protective effect are unclear. This study aimed to investigate if living on a farm alters the infant gut microbiota and thereby reduces the risk of developing allergic diseases in later childhood. This study was based on the prospective Farmflora cohort, which included 28 children living on a farm and 35 control children living in a rural area, who were followed from birth to 8 years of age. The gut microbiota was analyzed from 122 fecal samples collected from 48 children during the first 6 months after birth, using quantitative microbiome profiling. This novel method integrates 16S rRNA gene sequencing data with total bacterial load to obtain absolute counts of bacterial abundance. A significant increase in microbial diversity was seen in the gut microbiota of all the infants in the cohort over the first 6 months after birth. Similar alpha and beta diversity levels were observed in the farm and the control children. However, Sutterella, Megasphaera, and Dorea were more abundant in the gut microbiota of farm children. It has previously been observed that the farm environment was associated with low rates of allergy in children at 3 years. Taxa Akkermansia was more abundant in the gut microbiota of infants who were evaluated with allergy at 3 years. In addition, children who were healthy at 8 years had a higher abundance of Bifidobacterium in their gut microbiota at 6 months of age. However, the abundance of Bifidobacterium could not be linked to farm residence in this study. The findings were consistent with previous studies which link the higher abundance of Sutterella, Dorea, and Megasphaera with protection against allergic diseases. In conclusion, the study observed differences in the gut microbiota of children growing up on a farm, who have low rates of allergy, and showed Bifidobacterium may be protective against allergy development.