It could be great if there was a built-in Magnetic object type
in blender game engine.
For example,you create a magnetic object,then you choose the polarity(north,south or iron).To make a magnet,you join side by side 2 objects of different polarity.
I find a formula very close to real magnetic force progression:
Where MaxForce is the magnet force when DistanceVector is null.