Training Spam

Currently when I train Spam it goes to my Spam folder on my Mac but I want it to go to my IMAP Spam folder (which is called Junk in Apple Mail - even though the same folder is called Spam in Gmail itself).

Where can I set the preference for where the emails go when I train it?

Thanks

Please see the Change Settings command.