Bioinspired metal-based nanoparticles have potential uses in many applications, but before a possible commercial exploitation, it is important to clarify the pathways of their production and deposition inside the organisms, for example in bacteria. The technique of magnetic force microscopy (MFM) could be used to evaluate the nanoparticles magnetic properties, in addition to allowing tracing their location inside or outside of bacteria, which could help to understand pathways of their biosynthesis. In this work, using MFM and analyzing the interaction of magnetic tip with nanoparticles and bacteria imbedded in resin at different heights above the surface, and comparing gradients of forces recorded by magnetic and non-magnetic tips, a condition was found, which allows to measure pure magnetic response of Pd-Fe nanoparticles. For these nanoparticles, the interplay between magnetic and van der Waals forces is described at small distances to the surface. Experimental data are compared with simulations, based on the calculation of the distribution of magnetic field around a nanoparticle, which defines magnetic force acting on the MFM tip.