Enable nbextensions conditionally for different notebooks?

Is there a way to enable nbextensions conditionally with certain notebooks, folders, or when using a certain kernel?

I have a couple of courses which each use a different environment. I have set up kernels for each environment, and the notebooks for the courses are checked out via nbgitpuller. Now one of the courses requires certain nbextensions (from jupyter_contrib_nbextensions). I could install them globally, but if a course requires different sets of extensions, I have a problem and would need to set up separate servers.

Ideally, I’d have a yaml file in a folder that defines which extensions to activate. Does something like this exist? Or where should I start when trying to implement something like it?