As we know magnetars have strong magnetic field but what if we swap earth with a magnetar and the sun will released a solar wind. Is the magnetar affected by the solar wind or not ?
The solar wind is just a stream of charged particles, mostly protons and electrons, some alpha particles and a tiny trace amount of other stuff.
If the solar wind approached an uncharged Neutron star, then the particles would simply fall onto the neutron star or circle around it in a hyperbolic orbit. The Neutron star's gravity would add considerable velocity to the particles due to it's strong gravity. Any particle that falls within about 2 radii of the neutron star would inevitably fall towards it due to the space-time properties of relativistic orbits, so there would be some spiraling in and probably some kind of light-show in the process. The impacts of particles onto the surface would likely be in the x-ray or gamma ray spectrums and might not be that visible. Ultimately it wouldn't be that interesting, but perhaps there would be some kind of light-show.
If we give the Neutron star a strong magnetic field, then the solar wind would simply get redirected, similar to how it gets redirected by Earth's magnetic field, except in this case, the magnetic field is much stronger and the central object, much smaller. Probably very few of the solar wind particles would hit the Neutron star and most would just circle around it's magnetic field, which would produce (I think) less of a light show. There wouldn't be much effect that I can think of. The Magnetar star is very massive with a very strong magnetic field. The solar wind is comparatively, especially after spreading out for 93 million miles, quite diffuse and weak.
If a person got hit directly by the solar wind, it might be deadly. We're not very tough, but a magnetar is one of the most indestructible objects in the universe. The effect would be negligible.
It might be more interesting if you moved the Magnetar much closer to the star. Magnetic field lines can't cross each other, but they can push each other and flatten out, and in the case of solar flares they can get very twisted (but still never cross).
A magnetar is several orders of magnitude smaller than a sunspot. The interaction between the two magnetic fields, if the magnetar passed close to a sunspot would be interesting to see. (though the gravitational effect would still probably be the more impressive of the two) But if you move a Magnetar as distant as the Earth, the solar wind would have lost much of it's strength and it would just be ejected material from a solar magnetic storm. It wouldn't have much effect on the magnetar.
That's my hobbyist understanding anyway. If I missed any key points, please clarify your question or ask a new question.