This study investigates the vulnerability of DC microgrid systems to cyber threats, focusing on false data injection attacks (FDIAs) affecting sensor measurements. These attacks pose significant risks to equipment, generation units, controllers, and human safety. To address this vulnerability, we propose a novel solution utilizing a Non-Linear Autoregressive Network with Exogenous Input (NARX) observer. Trained to differentiate between normal conditions, load changes, and cyber-attacks, the NARX network estimates DC currents and voltages. The system initially operates without FDIAs to collect data for training NARX networks, followed by online deployment to estimate output DC voltages and currents of Distributed Energy Resources (DER). An attack mitigation strategy using a PI controller aligns NARX output with actual converter output, generating a counter-attack signal to nullify the attack impact. Comparative analysis with other AI-based methods is conducted, demonstrating the effectiveness of our approach. MATLAB simulations validate the method's performance, with real-time validation using OPAL-RT further confirming its applicability.