Ideally, the most reliable solution is to replace the motherboard entirely. If your motherboard is still under warranty, you can contact the manufacturer for a possible repair or replacement. However, replacing a motherboard can be expensive if it's not under warranty, and it's also quite involved, as it requires you to dismantle and reassemble your computer.
Alternatively, These solutions would be temporary and might involve:
Tape: You could try using non-conductive tape to help secure the RAM module in place.
Plastic Clip: You might be able to fashion a replacement clip from a small piece of plastic, although this would be quite difficult and has a high risk of damaging the motherboard or RAM module.