Helicobacter pylori is one of the most pathogenic organisms that cause gastritis, peptic ulcer, gastric adenocarcinoma, and mucosa-associated lymphoid tissue (MALT) lymphoma in humans. The main aim of this study was to determine the H. pylori infection among patients undergoing upper GI endoscopy and to compare the efficacy of the diagnostic method of H. pylori infection including invasive tests (biopsy-based tests like the rapid urease test (RUT), direct smear, and culture) and the noninvasive test (HpSA). A total of 100 stool samples and 200 gastric biopsy specimens were collected (2 samples from each patient) from June to November 2019. Stool samples were processed for the detection of an H. pylori stool antigen (HpSA) by a kit method. One biopsy specimen was processed for the RUT, and another was transported to the laboratory in an Eppendorf tube containing normal saline for preparation of the smear and culture. Out of 100 participants, 26% were found to be H. pylori positive by the RUT, 11% by the direct smear, 6% by the culture, and 17% by the stool antigen test. The prevalence of H. pylori infection was found to be 14%, considering at least two of the three biopsy-based tests that gave positive results. H. pylori infection was found to be higher in the age group of 46–55 years. The overall prevalence of H. pylori infection was higher in gastric ulcer cases, followed by erosive pangastritis and gastroduodenitis. Tea drinking habits and the frequency of meal consumption more than twice a day were found to be significantly associated with H. pylori infection (P < 0.05). Hence, the RUT was found to be more efficient than the direct smear and the culture method for finding H. pylori in the biopsy sample. However, none of these methods can be considered to be the gold standard alone. Thus, the RUT combined with other tests is preferable for the detection of H. pylori.