We reported the utilization of a series of heterobimetallic diblock copolymers to prepare different iron-cobalt/carbon and iron-cobalt phosphide/carbon magnetic materials. Through the control of compositions of ferrocene- and cobaltocenium-containing blocks, a transition of final inorganic materials from metal phosphide to metal alloy was observed. These metal elements were embedded on amorphous carbon films or encapsulated in crystallized multiwalled carbon nanotubes. Detailed magnetic characterization showed that all these inorganic materials were ferromagnetic under room temperature with great difference in their magnetic susceptibilities. The saturated magnetization was related with the weight fraction of phosphorus and cobalt, indicating the ability to control the magnetization of these inorganic materials via polymer compositions.