you have fallen for one of the oldest trick. He is just waiting
for you to screw up or finished the job and "then he come in like a
know it all". And claim the credit. All he needs is just one min to
convince superiors he is the know it all.
i have seen too many of such people. He and the manager may be
working buddies previously.
What you need to do is to protect all your work in written order,
like report, personnel involved, and submit work details.