I've got a virtual host which includes the next configurations

ServerName world wide web.host.com

ServerAlias *.host.com

Can One set

SetEnv FOO "bar"

just for a specific subdomain (like foo.host.com)?

The reply is the SetEnvIf directive:

SetEnvIf Host .*foo.host.com FOO=bar