I am a fresh PhD and I have job offer of Postdoctoral researcher in world leading university (QS rank 6) and assistant professorship in an average university (QS rank 339).
What is good for long term academic career?
Well, probably about the "long term carreer" it depends on the laws of the country you are working in. Moreover it is related to the type of studies in which you are involved in the "world leading university" compared to the "average university".
In my humble opinion you should decide first of all with the feeling that you have with your future working group. In fact the rank of the university is just an index but you should love the research you are involved and give everything to be one of the best in your field.
I'm also a newly graduated Ph.D. and personally, I'd prefer a postdoc position.
I think, that would be completely because I'd aim for getting more experience on the research topic I'm interested in and also couple other things, such as writing grants, proposals, or other important stuff that would lead to learning the basics of taking care of the whole lab.
It might be harder to get a grant the moment you accept the other position. On the other hand, it would give you the chance to work on your own projects.