As a native English speaker, I will admit to not always knowing the exact rule, but I do know how to use the language.
I have always understood “change in attitude” to refer to something which occurs over time, perhaps after learning new facts, or experiencing a situation for oneself leading to a revision of previously held opinions.
A “change of attitude” has always carried a connotation of immediacy, as in a parent telling a child they had best have a change of attitude right this moment, or else there will be consequences.