maybe being part of the government for the first time will make the AfD look bad
Yeah, that’s what happened to the FPÖ in Austria. They looked bad after being in a coalition for the first time, but recently the FPÖ won the election in September. Not sure how similar the parties are though.
Brothers of Italy won the 2022 elections, have a prime minister, and are as popular as ever, even though they have softened a bit in their rhetoric I would say.
Situation with parties like the AfD is similar in many other European countries.