ABSTRACT This paper addresses the problem of controlling time‐varying formation (TVF) in nonlinear multi‐agent systems (MASs) that are subject to false data injection (FDI) attacks. A malicious attacker can inject false data into an actuator, which leads to a deviation in the follower's perception of its own state or the state of its neighbors, and thus disrupts the formation control of multi‐agent systems (MASs). Meanwhile, the nonlinear nature of the system itself brings problems such as modeling uncertainty, control complexity, and difficulty in ensuring stability. To address the above challenges, this paper establishes a dynamic model of nonlinear multi‐agent systems (MASs) under false data injection (FDI) attack, and designs an observation and estimation mechanism with robustness for detecting and compensating the disturbances caused by the attack. On this basis, a distributed formation control strategy is proposed. Specifically, this paper designs a distributed control protocol based on neural networks, utilizes neural networks to approximate and compensate for unknown nonlinear terms, designs an adaptive compensator to defend against false data injection (FDI) attacks, and demonstrates the feasibility of the proposed control scheme with the help of Lyapunov stability theory. Finally, the feasibility of the proposed method is verified by simulation examples.