TMEM106B has been proposed as a modifier of disease risk in FTLD-TDP, particularly in GRN pathogenic variant carriers. Furthermore, TMEM106B has been investigated as a disease modifier in the context of healthy aging and across multiple neurodegenerative diseases. The objective of this study was to evaluate and compare the effect of TMEM106B on gray matter volume and cognition in each of the common genetic FTD groups and in patients with sporadic FTD. Participants were enrolled through the ARTFL/LEFFTDS Longitudinal Frontotemporal Lobar Degeneration (ALLFTD) study, which includes symptomatic and presymptomatic individuals with a pathogenic variant in C9orf72, GRN, MAPT, VCP, TBK1, TARDBP, symptomatic nonpathogenic variant carriers, and noncarrier family controls. All participants were genotyped for the TMEM106B rs1990622 SNP. Cross-sectionally, linear mixed-effects models were fitted to assess an association between TMEM106B and genetic group interaction with each outcome measure (gray matter volume and UDS3-EF for cognition), adjusting for education, age, sex, and CDR+NACC-FTLD sum of boxes. Subsequently, associations between TMEM106B and each outcome measure were investigated within the genetic group. For longitudinal modeling, linear mixed-effects models with time by TMEM106B predictor interactions were fitted. The minor allele of TMEM106B rs1990622, linked to a decreased risk of FTD, associated with greater gray matter volume in GRN pathogenic variant carriers under the recessive dosage model (N = 82, beta = 3.25, 95% CI [0.37-6.19], p = 0.034). This was most pronounced in the thalamus in the left hemisphere (beta = 0.03, 95% CI [0.01-0.06], p = 0.006), with a retained association when considering presymptomatic GRN pathogenic variant carriers only (N = 42, beta = 0.03, 95% CI [0.01-0.05], p = 0.003). The minor allele of TMEM106B rs1990622 also associated with greater cognitive scores among all C9orf72 pathogenic variant carriers (N = 229, beta = 0.36, 95% CI [0.05-0.066], p = 0.021) and in presymptomatic C9orf72 pathogenic variant carriers (N = 106, beta = 0.33, 95% CI [0.03-0.63], p = 0.036), under the recessive dosage model. We identified associations of TMEM106B with gray matter volume and cognition in the presence of GRN and C9orf72 pathogenic variants. The association of TMEM106B with outcomes of interest in presymptomatic GRN and C9orf72 pathogenic variant carriers could additionally reflect TMEM106B's effect on divergent pathophysiologic changes before the appearance of clinical symptoms.