Analyzing genomic and genetic sequences on the DNA level can be challenging due to the limited alphabet and sequence similarity varies depending on the labeling task, which makes tasks dependent on different evolutionary rates. In addition, metagenomic data poses significant challenges due to the vast diversity of taxa and genes within a microbiome. Here, we present Scorpio, a novel framework that employs triplet networks with contrastive learning, utilizing both pre-trained language models and k-mer frequency embeddings, to effectively a) discern taxonomic and gene information in metagenomic data and can be fine-tuned to b) identify drug resistance, etc. from AMR genes and c) identify promoters. Our approach demonstrates robust performance across a variety of tasks. It has notable performance in generalizing to novel taxonomic and gene classification (e.g. identifying known gene labels of sequences from novel taxa).The versatility of our triplet network framework for multitask classification highlights its potential for advancing health and environmental diagnostics. This method enhances our ability to process and interpret complex microbiome metagenomic data, offering significant implications for biomarker identification and the monitoring of disease and environmental health.