  The production of J/$\psi$ is measured as a function of charged-particle
multiplicity at forward rapidity in proton$-$proton (pp) collisions at
center-of-mass energies $\sqrt{s} =$ 5.02 and 13 TeV. The J/$\psi$ mesons are
reconstructed via their decay into dimuons in the rapidity interval (2.5 $< y
<$ 4.0), whereas the charged-particle multiplicity density (${\rm
d}N_{\rm{ch}}/{\rm d}\eta$) is measured at midrapidity $(|\eta| < 1)$. The
production rate as a function of multiplicity is reported as the ratio of the
yield in a given multiplicity interval to the multiplicity-integrated one. This
observable shows a linear increase with charged-particle multiplicity
normalized to the corresponding average value for inelastic events (${{\rm
d}N_{\rm ch}/{\rm d}\eta}/{\langle {\rm d}N_{\rm ch}/{\rm d}\eta \rangle}$), at
both the colliding energies. Measurements are compared with available ALICE
results at midrapidity and theoretical model calculations. First measurement of
the mean transverse momentum ($\langle p_{\mathrm{T}}\rangle$) of J/$\psi$ in
pp collisions exhibits an increasing trend as a function of ${{\rm d}N_{\rm
ch}/{\rm d}\eta}/{\langle {\rm d}N_{\rm ch}/{\rm d}\eta \rangle}$ showing a
saturation towards high charged-particle multiplicities.
