In this work, the MARS-F/K codes (Liu Y Q et al 2000 Phys. Plasmas 7 3681 & Liu Y Q et al 2008 Phys. Plasmas 15 112503) are utilized to model the passive and active control of the n=1 (n is the toroidal mode number) resistive wall mode (RWM) in a spherical tokamak (aspect ratio A=1.66). It is found that passive stabilization of the RWM gives a relatively small increase in normalized beta above the no-wall limit, relying on toroidal plasma flow and drift kinetic resonance damping from both thermal and energetic particles. Results of active control show that with the flux-to-voltage control scheme, which is the basic choice, a proportional controller alone does not yield complete stabilization of the mode. Adding a modest derivative action, and assuming an ideal situation without any noise in the closed-loop, the RWM can be fully stabilized with the plasma flow at 5% of the Alfven speed. In the presence of sensor signal noise, success rates exceeding 90% are achieved, and generally increase with the proportional feedback gain. On the other hand, the required control coil voltage also increases with feedback gain and with the sensor signal noise.