How can I make sure I'll get credit for my work when working with unwanted and untrusted collaborator? I am taking a course with a major final project. I was looking for a topic when my co-advisor noticed this. He suggested that I do a project related to my master thesis, and I agreed since I didn't know what I was going to do. He suggested that we do a certain design in half between me and a colleague of mine during a brief meeting with the course instructor. The course instructor asked if we are going to team up and I said no (I am not a team player). I submitted a proposal saying what I will do and as stretch goal, I will complete the whole design on my own. 

I ended doing a very smart design in one week and my co-advisor was very impressed. He said that one part of my design could be patented. The whole design can make it to top conferences. Now he is saying you both, me and my colleague, should work together to finish the whole design. I still have 3 weeks to go and I have almost finished his part too. I feel very mad now and I don't want to give him any credit that he didn't deserve(His is part is much simpler than mine).    

He is asking me to show him my design and I am not comfortable with that since he, in two occasions, performed "unethical actions" during these projects. He could easily claim that this is his work as well. 

On the other hand, I don't want to start a fight with my co-advisor who suggested a paper that helped me in my design. He also knows my design and likes my colleague much more than me. He could easily tell him do this and that.(I feel like I made a mistake showing him, my co-advisor, my design). 

What would be a smart move in this situation ? What words should I use to explain this to my advisor ? I just want to protect myself and get the credit for the work I did.
Communication is needed and you need to communicate to your co-advisor your feelings rather than second-guessing things and increase your frustration. You may lack some aspects of the picture that your advisor's see. So I would suggest the following:


Prepare everything to as close as the final product (manuscript) you can at this point. Add your name as sole author (unless anyone else deserves co-authorship at this stage)
Present the work to your co-advisor for discussion and point out what "little" is left to do and discuss what remains to be done. This can then lead to understanding of what other could contribute that is not accomplished in your work.
Once you have the situation a little more clear and depending on the outcome, state how you would like to see the distribution of co-authorship and take any discussion that follows.


Hopefully this will put you in a clearer position when considering taking on additional collaborators.

Please also check the tag authors or search for contributorship here on academia to et input on what should be involved in adding names on a manuscript (here is a link to one example).