The desalination performance of covalent organic framework (COF) membrane can be tuned through adjusting its layer spacing, which can improve the water permeance while maintaining high ion rejection rate. However, the mechanism of the influence of COF membrane spacing on its seawater desalination performance is still unclear. In this work, the molecular dynamics (MD) simulation were performed to systematically investigate the influence of the layer spacing on desalination performance of AB-stacked MPCOF, including 0.34 nm, 0.44 nm, 0.54 nm and 0.64 nm. The findings indicated a decrease in the resistance of water molecules passing through the AB stacked MPCOF membrane, leading to a significant increase in water permeance as the layer spacing increases. The interlayer spacing of the COF membrane also significantly influenced its interactions with ions. When the layer spacing exceeded 0.44 nm, the ion rejection rate began to decrease. As a result, the AB-stacked MPCOF membranes with 0.44 nm possessed the superior desalination performance, which was much better than other conventional membranes. Our work explored the mechanisms of the effects of COF layer spacing on desalination performance, which might provide valuable suggestions for the optimization of subsequent COF desalination membranes.