Solution (source code)

= Solution

Let $S_{xx}=\sum X_i^2$. The likelihood equations give
$$
\hat\beta=\frac{\sum X_iY_i}{S_{xx}},\qquad
\hat\sigma^2=\frac1n\sum(Y_i-X_i\hat\beta)^2.
$$
These are orthogonal projections of a Gaussian <vector> onto the span of $X$ and its orthogonal complement, hence are independent.