Dendrobium nobile is the only plant that could produce the natural bioactive dendrobine. No other source of dendrobine has been found to date except from D. nobile and via chemical synthesis. In this study, we aimed to examine the potential fungal endophyte isolated from D. nobile stem segments using the molecular method and to detect dendrobine compound through high-performance liquid chromatography (HPLC), gas chromatography–mass spectrometry (GC-MS), and liquid chromatography with tandem mass spectrometry (LC-MS/MS) and their metabolite for their antibacterial activity. The potential dendrobine producer strain was recognized as Trichoderma longibrachiatum based on molecular DNA sequencing and GenBank databases. The T. longibrachiatum MD33 produced dendrobine and other compounds in a potato dextrose medium (PDM), as confirmed by HPLC retention time peak analysis. The HPLC results revealed that T. longibrachiatum MD33 biomass showed a peak retention time of 5.28 ± 0.2 min, similar to wild D. nobile stem dendrobine (5.32 ± 0.2 min) and standard chemical reference dendrobine (5.30 ± 0.2 min), indicating the presence of dendrobine in the fungal biomass. Results of GC-MS and LC-MS analysis revealed that T. longibrachiatum MD33 produced the same molecular weight (263 in GC-MS and 264.195 in LC-MS) of dendrobine as compared with standard chemical reference dendrobine and D. nobile dendrobine. Antibacterial activity data revealed that T. longibrachiatum MD33 produced the strongest bactericidal activity against Bacillus subtilis, Bacillus mycoides, and Staphylococcus species, and the diameter of the bacterial growth inhibition zone was 12 ± 0.2, 9 ± 0.2, and 8 ± 0.2 mm, respectively. To the best of our knowledge, this was the first study to investigate T. longibrachiatum as a dendrobine producer, and the results revealed that T. longibrachiatum was directly involved in the potential production of a similar bioactive compound to D. nobile (dendrobine). In addition, the T. longibrachiatum metabolite exhibited potent antibacterial activity and can be a potential strain for medical and industrial purposes.