if yes then can we deploy it on spacecrafts etc to carry out deep space exploration which we are currently avoiding fearing solar flares ,cosmic waves etc because such magnetic field would surely do the same work as it does for our planet.
The earth's magnetic field is quite weak compared to what we can create, so yes. But I think the question is really about deflecting "space dangers", which is mostly done by the earth's atmosphere.
To defend the spacecraft from cosmic radiation, one could consider strong (superconducting) electromagnets, but I am not sure they can provide adequate defense. As for the question in the title, it looks like a physical model of the geomagnetic field has been created (https://www.technologyreview.com/s/601699/how-geophysicists-built-a-scale-model-of-earths-core-out-of-sulfuric-acid/)