I am in year 7 and I really like this guy same age as me and I think he secretly likes me but his best friend (who I don't like) likes me and he doesn't want to upset his friend by going out with me so he pretends he doesn't like me. but when his best friend isn't there he always smiles at me and talks to me but when he is around he just pretends he doesn't notice me. what do I do?
You don't need to do anything. At age 13 this guy has not learned how to act in public, but he knows perfectly well that other boys are going to tease him if he gets friendly with any girl. So you just can't expect much from him or any other boys.
You, being the same age, have the same problem. It takes time to learn how to act in social settings. And you are going to meet a lot of young men that you will never see again in that time. So don't get impatient, and don't tell yourself that you have to do something right away.