Ideally you should use an end mill to cut a very shallow flat-bottomed hole, creating a slight ridge to hold the magnet in position mostly above the metal and fulling in contact with it on the back face (without "shorting out" a significant amount of its flux or creating a big void below the metal-facing pole) while you attach the other magnets and encapsulate the assembly.