You want to check the actual headlight switch terminal that the dimmer wire goes to. To see if that terminal goes hot when knob pulled out. If it does go hot every time, the problem is that wire. if it does not, It's the switch. That terminal will be hard to get to. So leave the wire on until you drop switch with all wires still on it, then test that terminal and report. I will be around and checking on what you say.
If switch is "bad" you can probably fix it. It's gratifying to fix. Getting it apart without damage is tricky but once inside it's just a matter of cleaning and light sanding the sliding contacts. There are springs in there to maintain contact between sliding and stationary contacts.....OR...
You can buy a new one from China.
Don't disconnect any wires from switch unless you label each wire and make a note and a drawing and take pics. We don't want to lose any possible cause of this loss of power to dimmer and never know how it was wired and in case of new switch, it will be easy to install. I know it seems we are going slow and doing dumb stuff, be it is necessary or we will chase our tail.
Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. - William Penn