With adjectives like 好き it is possible to say the following
[sentence 1] りんごがすきです
[sentence 2] わたしがすきです
Sentence 1 should be relatively easy to understand
Someone likes apples.
Sentence 2 isn't particularly clear when completely divorced from context.
It could mean,
Someone likes me
I would say that without any further context, this is the default reading.
But it could also mean,
I like something.
There's a lot of discussion on this site about the difference between は and が in this sort of context. I'll leave that discussion aside except to say that as a stand alone sentence
Either sounds like I am liked by someone or I am the sole individual within some group who likes something.
But, we don't have a stand-alone sentence here.
We have instead
せんぱいが好きな is a relative clause modifying 食べ物. Since foods typically don't have a preference for who's going to eat them (unless your in some strange alternate universe of anime, sci-fi, etc), the most natural way to construe this is that 食べ物 is what is being liked.
That means that the relative clause
functions much like sentence 2 above in the sense where it is せんぱい is the one who is liking something.
But, there is one important caveat here. The は-が distinction I mentioned above is null here. That's because は as the topic marker cannot be embedded in a relative clause (when は is found in a subordinate clause, then は is not marking the topic but usually functioning contrastively).
So this が in the relative clause marks the subject who likes some kind of food. Unlike sentence 2 above, in a relative clause, the reading is neutral: that is, nothing is to be construed as せんぱい being the only individual who likes something.
You could indeed say
But if you're thinking this の is a possessive marker indicating
then you are unfortunately mistaken. A native speaker is not naturally inclined to hear it like this. That is because の can be used in relative clauses (under special conditions which apply here) to stand in for the subject marker が.
For details on subtopics I've brought up: