Background: Neighbourhood socioeconomic disadvantage has been linked to increased diabetes risk, but little is known about differences in risk factors in childhood and adulthood in those with high and low neighbourhood socioeconomic disadvantage, or about the association between long-term neighbourhood socioeconomic disadvantage and incidence of diabetes in adulthood. We used data from the prospective, population-based Young Finns Study to address these questions. Methods: We did a nationwide population-based cohort study in Finland using data from The Young Finns Study, which included 3467 participants aged 6–18 years followed up for over 30 years via eight repeated biomedical examinations and linkage to electronic health records. Participants were also linked to national grid data on neighbourhood disadvantage via their residential address from age 6–48 years. We used these data to examine differences in ten risk factors (dietary habits, physical activity, daily smoking, body-mass index, systolic blood pressure, fasting HDL cholesterol, fasting triglycerides, fasting plasma glucose, fasting serum insulin, and homoeostasis model assessment insulin sensitivity) from childhood (6–21 years) to adulthood (22–48 years) among individuals with high (>0·5 SD above the national mean) and low (≥0·5 SD below the national mean) neighbourhood socioeconomic disadvantage, and the association of cumulative neighbourhood socioeconomic disadvantage with six cardiometabolic risk factors (obesity, high waist circumference, fatty liver, hypertension, carotid plaque, and left ventricle mass index) and diabetes by middle age (22–48 years). We used logistic and linear regression analyses to assess the effects of neighbourhood disadvantage on cardiometabolic and diabetes risk, controlling for potential confounders (age, sex, and individual socioeconomic disadvantage). Findings: We included data for 3002 individuals with risk factor assessment in childhood and adulthood. Of whom, 2048 underwent a clinical examination during the last follow-up at age 33–48 years. Differences in risk factors by neighbourhood socioeconomic disadvantage at the beginning of follow-up were small, but large differences emerged over the follow-up. High neighbourhood socioeconomic disadvantage was characterised by decreased fruit and vegetable intake as early as age 6 years, decreased physical activity, and increased prevalence of daily smoking from adolescence (12 years) onwards, and decreased homoeostasis model assessment insulin sensitivity and increased fasting glucose and insulin concentration from early adulthood (27 years; all p<0·03). Individuals consistently exposed to high neighbourhood socioeconomic disadvantage were more likely to be obese (odds ratio [OR] 1·44, 95% CI 1·01–2·06), hypertensive (1·83, 1·14–2·93), have a fatty liver (1·73, 1·11–2·71), and diabetes (3·71, 1·77–7·75), compared with those who were consistently exposed to low neighbourhood socioeconomic disadvantage. Interpretation: Living in socioeconomically disadvantaged areas can shape health in childhood and adulthood. Neighbourhood socioeconomic disadvantage is associated with differences in health risks across the life course, including detrimental lifestyle factors from childhood and adolescence onwards and worse glucose metabolism from early adulthood. By middle age, cumulative neighbourhood socioeconomic disadvantage is associated with increased cardiometabolic risk factors and increased incidence of diabetes. Funding: Academy of Finland, NordForsk, UK Medical Research Council, European Commission, and European Research Council.