If there’s an issue with the grounding point, you may need to sand down the inner fender and ground block, after which you should use a star washer to screw down the fender side to ensure a solid ground.
If that doesn’t work, you may need to take apart the dimmer switch and check to ensure that there are no loose or worn wires causing a short or failed contact point.
If, once again, that doesn’t fix the issue, try removing the circuit board and giving it a thorough clean—dielectric grease can sometimes build up and trap grime, shorting the circuit paths. After cleaning, re-grease the connection prongs and reinstall the circuit board.