Judge Barbara Lee, who has also banned the university from beginning construction on the site, ruled late Thursday that the fence does not infringe on the free speech rights of those opposed to a new Berkeley stadium, The Oakland Tribune reported.
The university faces lawsuits from the city of Berkeley and a neighborhood group over the proposed stadium.
Members of the California Live Oak Foundation moved into the trees Dec. 2.
The university argued that the fence was needed to keep football fans away from the demonstrators. Thousands of people were expected Saturday for Cal's season opener against Tennessee.
"It is well established that property owners and governmental entities may establish reasonable time, place and manner restrictions on the exercise of free speech," the judge said.