As stated in my lecture note the theorem say that if we have a decomposition of the minimal polynomial of $T$ into irreducible elements in $\mathbb{F}[\lambda]$
$m_{T}(x)=(\varphi_{1}(\lambda))^{c_{1}}...(\varphi_{r}(\lambda))^{c_{r}}$
Then there are $r$ invariant subspaces $W_{1},...W_{r}$ s.t $V=W_{1}\oplus...\oplus W_{r}$ and $T|_{W_{i}}=\varphi_{i}(\lambda))^{c_{i}}$
In your case you have some polynomial $p$ s.t $p(T)=0$ and $p$ splits into distinct linear factors, since $m_{T}\mid p$ we have it that $m_{T}$ splits into distinct linear factors.
Let $\alpha_{1},...,\alpha_{r}\in\mathbb{F}$ s.t $m_{T}(x)=(x-\alpha_{1})...(x-\alpha_{r})$ (and recall $i\neq j\implies\alpha_{i}\neq\alpha_{j})$.
Since each $W_{i}$ is invariant and by the stated above we have that this means $T(W_{i})\subset W_{i}$ and $\forall v\in W_{i}:\, T|_{W_{i}}(v)=\alpha_{i}v$
Denote $k_{i}:=dim(W_{i})$, then by $V=W_{1}\oplus...\oplus W_{r}$ we have it that $k_{1}+...+k_{r}=n$. Take a basis $B_{i}$ for $W_{i}$ and from $\forall v\in W_{i}:\, T|_{W_{i}}(v)=\alpha_{i}v$ deduce that $[T|_{W_{i}}]_{B_{i}}$ is of the form $diag(\alpha_{i},...,\alpha_{i})$
Since this is a direct sum we have a basis $B=\cup B_{i}$ and $[T]_{B}$is diagonal as a direct sum of diagonal matrices.
Note: You can also use Jordan normal form to deduce that the minimal polynomial splits into distinct linear factor iff the matrix is diagonalizable but I chose to do it by the theorem as asked (the existence of the Jordan normal form in this case should not worry you since the eigenvalues are on the field in this is sufficient, in any case there is a field containing $\mathbb{F}$ in which the Jordan normal form exist).