If your fridge is making a loud rattling sound, when it is switch on, the noise may occur because the fridge is not level. A wonky fridge can trigger various rattling sounds, so get a spirit level, place on top of the fridge and see if it is correctly and accurately leveled. This is by looking in the middle part of the spirit level, if the bubble is not in the middle, your fridge is not level. If it's not level, try place the fridge in different positions and you will hopefully find the perfect spot.
If you have leveled up your fridge and the rattling noise is still happening, then it is cause because of a faulty fridge motor. There is nothing much you can do about this unfortunately, unless you replace the motor, or replace the complete fridge, either way it is your choice.