Some time ago I started my Ph.D. and my project was to attempt again to investigate a problem that a colleague (a senior Ph.D.) had failed to investigate because he lacked numerical/coding skills to attack the problem. Essentially our advisor put me to work on a line of research that senior phd had abandoned, and I started from his (few) old results, spent 9 months writing code and running the simulations, and finally obtained some interesting results. Senior PhD, though he mostly contributed with discussions and one plot, casually claimed co-first-authorhip by asking to our advisor when I was not there, but the request was refused.
For the last 6 months we worked on a natural continuation of the previous research. Senior phd insisted to collaborate intensely at the beginning and for the first month we surely did, but later he was caught by other things (writing 2 other papers, writing the PhD dissertation..) and I continued my work alone with a PostDoc. SeniorPhd always attended discussions.
It is now time to start writing the paper, and he said he would write it, as he has alredy written part of those results in his dissertation and because he writes faster than me (so we can publish before other groups) . I politely refused during the meeting, so he offered to co-write the results with me.
Our advisor ignored the issues and pushed to move onto other topics.
After that meeting, senior Ph.D. started to ask me to explain a few things that he still did not get about the method, and I explained him. He then proceeded to make a few very quick simulations to produce the first 2 figures of the paper and presented those to the PostDoc a few hours after I was done explaining him.
I felt as if he is trying to force himself as first author/coauthor by simply starting to write a research in which he did not do the majority of the work.
All the data is in a shared drive, so in principle, he could write everything up.
How can I confront the issue without looking like an asshole who refuses to be helped by a very kind collegue?