Ranking is more important than the mark you receive at school.
However, that's assuming that having a good rank means you had a good mark that will reflect your performance in the HSC exam.
If you came first with a mark in the trial of 30%, although you still attain the highest exam mark as your internal assessment mark, that mark may be be very great so it also doesn't necesarilly mean having a good rank means you'd get a good HSC mark.
Ranking determines the type of HSC assessment mark you'd receive as well as the relative difference in marks between you and your classmates.