This question showed up in a number theory test from previous semesters so I might not know all the material needed to solve this question but here is my try:
The function $f(x)=\frac{\log^2(x)}{x}$ is bounded in $(1,\infty)$ so for some upped bound $C$ on $f(x)$ we have $$\sum_{p\leq x, p\, \text{prime}} \frac{\log^2(p)}{p}\leq C\cdot \pi(x)$$ on the other hand for large enough $x$ we have $\min\left\{\frac{\log^2(p)}{p}|p\leq x, p\, \text{prime}\right\}\geq \frac{\log^2(x)}{x}$ and so: $$\sum_{p\leq x, p\, \text{prime}} \frac{\log^2(p)}{p}\geq \frac{\log^2(x)}{x} \pi(x)\stackrel{PNT}{=}O(\log(x))$$ Both bounds dont give a tight bound and here I am pretty much stuck.
This isn’t number theory. It really is only analysis.
Note that if $(p_n)_n$ is the increasing sequence of the prime numbers, it’s technically easier to find an equivalent for $S_n=\sum_{k=1}^n{\frac{\ln^2{p_k}}{p_k}}$.
That’s a series, and the general term can be easily (using the PNT) proved equivalent to $\frac{\ln^2{k}}{k\ln{k}}=\frac{\ln{k}}{k}$. In particular, the series is divergent, and thus $S_n \sim \sum_{k=4}^n{\frac{\ln{k}}{k}}$.
Using a series-integral comparison, the sum above can be shown equivalent to $\frac{\ln^2{n}}{2}$.
So the original sum is equivalent to $\frac{\ln^2{\pi(x)}}{2} \sim \frac{\ln^2{x}}{2}$.