The coca leaf, the natural source of cocaine, has been used as a mild stimulant for many centuries. In addition to use in Precolumbian religious ceremonies, chewing this leaf helped people in high Andes mountains adjust to the thin mountain air and have the energy to complete physically taxing tasks.
Cocaine was first extracted from the coca leaf in 1859. Therefore, it did not exist 200 to 300 years ago as your question asks. Therefore, I will discuss how the justification for its use changed over the course of the drug's early years.
Pretty quickly physicians in Europe began using it as a local anesthetic. However, it was not until the 1880s that cocaine found widespread use in the medical community. It became popular for its effects as an analgesic. It was also further developed into a rather effective nerve-block anesthetic. As you can see, the earliest uses of cocaine were for its potential and realized uses as a pain killer and anesthetic. Additionally, some claimed that it could cure excessive flatulence and whiten teeth.
By the end of the 19th century, people even began using cocaine purely for its psychoactive effects. This was justified by many who saw its effects as a positive and a better alternative to alcohol consumption. For instance, one American manufacturer of cocaine products claimed that it could "supply the place of food, make the coward brave, the silent eloquent and render the sufferer insensitive to pain." As you can see, in its early days, cocaine was considered a helpful stimulant that could address a number of health issues and help people be more happy, productive, and efficient.
This all steadily changed over the course of the early 20th century. As cocaine was replaced by more efficient pharmaceuticals, it lost its position in the medical world. However, its use as a recreational drug expanded. As this happened, more negative effects of cocaine became apparent. In 1922, cocaine was criminalized in the United States as a result of the thousands of deaths it had caused.
Over the next several decades, cocaine found popularity as an illicit party drug. The energy and euphoria that cocaine gives its users were seen as the perfect accompaniments to staying up through the night and partying until dawn. Despite the dangers that come from impure samples of cocaine and overuse, as well as the violence associated with its production and distribution, cocaine remains one of the most trafficked drugs worldwide.