The “#” merely tells mDosbox (and pretty much every other backend tool) to ignore that particular command line.
So all you need to do is just
cycles=40000 (or “fixed 40000”, it’s the same)
You can leave the cycle up/down lines in, or comment them out, it doesn’t matter. They only tell Dosbox (on PC) how many cycles to increase or decrease when you press the key combo (not sure, I think it’s Ctrl+F11/Ctrl+F12 or so). They don’t do anything in mDosbox, afaik.