With the launch of Model Targets and its restriction of only a single Model Target dataset being activated at a time, we have seen an increase in the number of questions related to loading and activating datasets programmatically.
I've attached a script to this post that provides two examples for doing this. One function within this script will de-activate all currently active datasets in your project and then activate the dataset given in the function's signature. The second function will directly load and activate a single dataset without de-activating any others. The script contains additional information about the process via in-line comments.
Please note that the file is attached as a .txt. You'll need to change the extension to .cs in order for it to work within your project.
Also note that the provided script is only meant as an example and not a comprehensive guide. For additional information on loading and activating datasets, please refer to the library and api documentation.