I’m running a mixed effects model. My predictor of interest in a dichotomous variable. The largest difference I would expect between the two levels of my predictor is 40. How do I go about turning that into a prior?

This information on its own is insufficient to elicit an informed prior (but it’s a good start!). There are many distributions that top out at values near 40. Some distributions will place most of the probability mass near and a bit below 40. Others will place a great deal of probability mass at values much smaller than 40.

Furthermore, in a mixed modeling context (i.e. if you have a random slope term for your dichotomous predictor variable), then the maximum expected difference between the two levels of your predictor will depend jointly on the prior for the random effect mean, the prior for the random effect variance, and the number of random effect levels (when there are more differences associated with more levels, the maximum difference will tend to occur further out into the tail of the random effect distribution).

If you want a prior that accurately reflects your domain knowledge, you’ll want to choose from the large array of priors that top out somewhere near 40, and your choice will depend on your knowledge about the rest of the range of plausible values. If you want a “weak” prior that provides some regularization while letting the data dominate the posterior, then you might consider priors that extend a moderate amount higher than 40. In this case as well, your specific choice of prior would depend on your knowledge about the rest of the range of plausible values.

For some discussion of building prior models from threshold information see Sections 1.1.1.2, 1.1.1.3, and 1.1.1.4 of https://betanalpha.github.io/assets/case_studies/principled_bayesian_workflow.html#111_quantifying_consequences as well as the discussion in https://betanalpha.github.io/assets/case_studies/weakly_informative_shapes.html.