Hamiltonian system is a special case of dynamical system. Mostly it is used for potential shaping of mechanical systems stabilization. In our present work, we are using Hamiltonian dynamics to study and control the fuel slosh inside spacecraft tank. Sloshing is the phenomenon which is related with the movement of fluid inside a container in micro and macro scale as well. Sloshing of fluid occurs whenever the frequency of container movement matches with the natural frequency of fluid inside the container. Such type of synchronization may cause the structural damage or could be a reason of moving object's attitude disturbance. In spacecraft technology, the equivalent mechanical model for sloshing is common to use for the representation of fuel slosh. This mechanical model may contain a model of pendulum or a mass attached with a spring. In this article, we are using mass-spring mechanical model coupled with rigid body to derive the equations for Hamiltonian system. Casimir functions are used for proposed model. Conditions for the stability and instability of moving mass are derived using Lyapunov function along with Casimir functions. Simulation work is presented to strengthen the derived results and to distribute the stable and unstable regions graphically.