You have an observation $t$ of the total time for occurrence of an unknown but fixed number of events $n$ from a Poisson process with known rate parameter $\lambda$, & want to estimate $n$. Note that the random variable $T$ is the sum of $n$ exponentially distributed random variables (the waiting times between each event†), & therefore has an Erlang distribution (a gamma distribution with an integer shape parameter); the density is
$$f(t) = \frac{\lambda^n}{(n-1)!} \cdot t^{n-1} \cdot \mathrm{e}^{-\lambda t}$$
& the log-likelihood (dropping terms constant in $n$) is
$$\ell(n) = n \log \lambda t - \log (n-1)!$$
As $n$ is restricted to integer values‡, trial & error should be efficient enough for finding where the log-likelihood has a maximum; the population mean is ${n}{\lambda}$ so it should be at around $\lambda t$. [As @Dilip has pointed out, you don't in fact need to resort to trial & error: the ratio of likelihoods as $n$ increases is given by
$$ \frac{f_{n+1}}{f_n}=\frac{\lambda t}{n}$$
, which is greater than one while $\lambda t>n$; & so $\hat n = \lceil \lambda t \rceil$.]
† Because the Poisson process is memoryless, it isn't necessary to ask whether the beginning of the time period is at or between event times.
‡ If $n$ weren't restricted to integer values then the score is
$$\frac{\mathrm{d}\ell(n)}{\mathrm{d} n}= \log \lambda t - \frac{\frac{\mathrm{d}\Gamma(n)}{\mathrm{d} n}}{\Gamma(n)}\\
= \log \lambda t - \psi (n)$$
where $\psi(\cdot)$ is the digamma function, & hence the maximum likelihood estimate for $n$ is found where the score is zero:
$$\hat n = \psi^{-1}(\log \lambda t)$$