The Lagrangians and dissipation functions are proposed for use in the electrodynamics of the double-negative and chiral metamaterials with finite loss. The double-negative metamaterial considered here is the ‘wires and split-rings’ periodic structure, while the chiral metamaterial is the ‘single-resonance helical resonators’ array. For either system, application of Legendre transformation leads to a Hamiltonian density identical to the energy density obtained in our previous work based on the Poynting theorem and the mechanism of the power loss. This coincidence implies the correctness of the energy density formulas we obtained before. The Lagrangian description and Hamiltonian formulation can be further developed for exploring the properties of the elementary excitations or quasiparticles in dispersive metamaterials due to light–matter interactions.