Let's consider $n$ particles with for the $i$-the particle: mass $m_i$, position $x_i$ (a 3-vector), charge $q_i$. The dynamics in the non-relativistic case can be derived from the following Lagrangian.
$$L = \sum_{i=1}^n\frac{1}{2}m_i\dot{x}_i^2 - \sum_{i=1}^{n-1}\sum_{j=i+1}^n \frac{1}{4\pi}\frac{q_iq_j}{\|x_i - x_j\|}$$
You can then get the Hamiltonian easily from the Lagrangian. Moreover, potential means interaction between two particles and has been defined in that way. So, you don't have to count it twice.
It should be noted that the effect of the magnetic field generated by one moving particle on another particle is proportional to $\frac{\dot{x}}{c}$ and it is therefore neglected in the non-relativistic limit I have adopted here. C.f. chapter 8 of [1] for example.
What about a completely relativistic treatment? In this case, we would need to write a Lagrangian for the both of the particles and the electromagnetic fields. Indeed, the accelerated charges will radiate electromagnetic waves, and loose energy in the process, so there is no Lagrangian formalism solely for the particles. But we can write the equations of motions. First, the momentum of the $i$-th particle is
$$p_i = \frac{m_i\dot{x}_i}{\sqrt{1-\dot{x}^2}}$$
Then
$$\dot{p}_i = \sum_{j \ne i} q_i\left(E_j(x_i) + B_j(x_i)\times\dot{x}_i\right)$$
where $E_j(x_i)$ and $B_j(x_i)$ are the electric and magnetic fields created by the $j$-th particle at position $x_i$. Expressions for those fields, based on the so-called Lienard-Wiechert potentials, can be found in [1], eq. (63.8) and (63.9). I am totally ignoring the issue of the Abrahams-Lorentz-Dirac force here, as there is no meaningful treatment of it anyway.
[1] Landau & Lifshitz, The classical theory of fields