Remote magnetic sensing can be used to monitor the position of objects in real time, enabling ground transport monitoring, underground infrastructure mapping, and hazardous detection. However, magnetic signals are typically weak and complex, requiring sophisticated physical models to analyze them and a detailed knowledge of the system under study, factors that are frequently unavailable. In this work, we provide a solution to these limitations by demonstrating a machine-learning (ML) method that can be trained exclusively on experimental data, without the need of any physical model, to predict the position of a magnetic target in real time. The target can be any object with a magnetic signal above the floor noise, and in this case, we use a quantum diamond magnetometer to track variations of a few hundred nanoteslas produced by an elevator moving along a single axis. The one-dimensional movement is a simple yet challenging scenario, resembling realistic environments such as high buildings, tunnels, or train circuits, and is the first step toward building broader applications. Our ML algorithm can be trained in approximately 40 min, achieving over 80% accuracy in predicting the target’s position at a rate of 10 Hz, for a positional error tolerance of 30 cm, which is well within the the 4-m spacing between parking levels. Our results open up the possibility to apply this ML method more generally for real-time monitoring of magnetic objects, which will broaden the scope of magnetic detection applications.