To determine whether a combination of mood and personality factors together with illness beliefs and behaviours predict the onset of irritable bowel syndrome (IBS) post gastroenteritis, as suggested by the cognitive behavioural model of IBS. Primary care patients with a positive test for Campylobacter gastroenteritis, and no previous history of IBS or serious bowel conditions were recruited into this prospective study (n = 620). Participants completed a questionnaire at the time of infection, which included standardised measures of mood, perceived stress, perfectionism, negative illness beliefs and illness behaviours. Participants completed follow-up questionnaires designed to determine whether they met the Rome criteria for IBS 3 and 6 months after initial infection. A total of 49 participants met the criteria for IBS at both follow-up points. Logistic regressions indicated that those who developed IBS had significantly higher levels of perceived stress (1.10, 95% CI 1.02 to-1.15), anxiety (1.14, 95% CI 1.05 to 1.23), somatisation (1.17, 95% CI 1.02 to 1.35) and negative illness beliefs (1.14, 95% CI 1.03 to 1.27) at the time of infection than those who did not develop IBS. Patients with IBS were also significantly more likely to remain active in the face of their acute symptoms until they felt forced to rest (all-or-nothing behaviour) (1.09, 95% CI 1.03 to 1.16), and significantly less likely to initially rest in response to their acute illness (0.93, 95% CI 0.88 to 0.97). Depression and perfectionism were not associated with the onset of IBS. Results suggest that patients with high stress and anxiety levels are more prone to develop IBS after a bout of gastroenteritis. Additional risk factors include a tendency to interpret illness in a pessimistic fashion and to respond to symptoms in an all-or-nothing manner.