Can you smooth mains A.C?
You could try a mains surge suppressor. They are cheap and might work if the problem is excess spikes on the mains. Do the LED lights flicker if driven from a wall circuit rather than lighting circuit? If so, try the suppressor. If not, then it is something else