Synthetic gradiometers constructed by superconducting quantum interference device (SQUID) magnetometers are effective ways to suppress the magnetic disturbance while keeping the useful signals unaffected. In this article, in order to obtain the optimal baseline for a first-order synthetic gradiometer (FOSG) inside a thin magnetically shielded room (MSR), a modeling method based on the magnetic flux distributions in the sensing and reference magnetometers is proposed. Then the model is built in the Ansys platform, and the baseline can be determined as 6 cm under a certain signal source depth of 4 cm after conducting the finite element calculation. Two kinds of magnetometers with different pickup coils contribute to the realization of the testing system. The testing results are in good agreement with the simulation ones. And depending on this optimized configuration of the FOSG, the residual field of a real thin MSR can be restrained from 2.0 nT to 4.0 pT. Moreover, a clear magnetocardiography (MCG) signal with an amplitude of 48 pT and stable zero-line can be observed when applying a subject for the test, which further verifies the effectiveness of this modeling method.