You need to find average rating for each palyer in subquery as shown below
$query = "SELECT a.player,a.team,a.loc,a.pic,a.rank,b.rating FROM college AS a
JOIN (
SELECT player,AVG(rating) AS rating
FROM college_rating
GROUP BY player
) AS b
ON a.player=b.player
ORDER BY rank DESC LIMIT 20";