In this work, we study the extremal functions of the log-Sobolev functional on compact metric measure spaces satisfying the $\mathrm{RCD}^*(K,N)$ condition for $K$ in $\mathbb{R}$ and $N$ in $(2,\infty)$. We show the existence, regularity and positivity of non-negative extremal functions. Based on these results, we prove a Li-Yau type estimate for the logarithmic transform of any non-negative extremal functions of the log-Sobolev functional. As applications, we show a Harnack type inequality as well as lower and upper bounds for the non-negative extremal functions.