If I intend to visit a friend in the US and then depart to a third country to begin my Master’s Program rather than fly back to my country, will this negatively impact my application for a B2 Tourist Visa to the US? I'm no longer working because my studies in the third country are starting soon.
Whether you physically leave the US on a plane bound for your home country or directly to the place where you embark on further studies has no significance whatsoever for the visa decision.
In your application you need to make a case that it will be in your own best selfish interest to leave the US after the visit you propose. There is, objectively speaking, nothing that pulls you back to your home country strongly enough for this, as evidenced by the fact you're planning to go away to study for several years elsewhere. So your only hope for the visa application is to argue that the master's program you will be joining is so attractive that it's a better choice for you than staying in the US as an undocumented immigrant would be.
This is not quite a routine situation, and it would be hard to make a guess at your chances. But playing games with your physical itinerary is not going to influence it.
.. with one caveat, namely that if going directly to your new home means that you will travel with a lot of baggage that you otherwise would have left home and picked up later, that can make it look at the border like you're intending to move to the US for good, which will mean trouble. But if you're traveling reasonably light and getting most of your possessions shipped separately to the place where you will study, there'll be no particular problem there.