Override theme programmatically

You could use switch_theme function.

Accepts one argument: $stylesheet of the theme. ($stylesheet is the name of your folder slug. It’s the same value that you’d use for a child theme, something like “twentythirteen”.)

Documentation: switch_theme