The valet key can likely be reworked to fit the trunk / glove box ( at least on my 97 C280 and I'd expect the metal key ML to be the same.). Supposedly the valet keys were NLA and you could only get a clipped head wallet key so I'm surprised you came up with one..
I haven't done this but see no reason it won't work.
Compare the original and valet keys, the original will have a step on the flat side and the valet not. Running this on a milling machine should allow you to cut a step.
Near as I can tell, the ML used a DAS X or very close version just like the 97-98? C class, 97 E320 , 97 SL , 97 + S class. This was a metal key that went into the column lock not the fob with a rectangle that goes into the lock.
There is a RFID chip not a GM style resistor in all of these keys that gets read by the anti theft computer then a signal gets sent to the engine computer to unlock it. The chip gets updated every time the car is started so it a weak battery interrupts this sequence, a bad write occurs. I'd get the battery load tested, I've had otherwise strong batteries drop a cell and crank forever but voltage drops too low while cranking. If you are losing radio presets and clock settings, the battery is failing.