We introduce and study a Hamiltonian formalism of mutations in cluster algebras using canonical variables, where the Hamiltonian is given by the Euler dilogarithm. The corresponding Lagrangian, restricted to a certain subspace of the phase space, coincides with the Rogers dilogarithm. As an application, we show how the dilogarithm identity associated with a period of mutations in a cluster algebra arises from the Hamiltonian/Lagrangian point of view. 1 2. Preliminaries 2.1. Mutations in cluster algebras. Let us recall two main notions in cluster algebras, namely, a seed and its mutation. See [FZ02, FZ07] for more information on cluster algebras.