It's about time to write off high-growth tech stocks, Goldman Sachs warned, saying the double whammy of sky-high valuation and heightened talk of regulation is becoming a "hazard" to the group.

Technology stocks have been investors' darlings for years as the appetite for superior growth shows no signs of slowing. Software names especially are big hits this year because of their big profit margins and insulation from the trade tensions. However, Goldman is sounding the alarm on their "lofty" valuations as well as investor's overoptimism toward the antitrust probe on Big Tech.

"Rising market concentration and the political landscape suggest that regulatory risk will persist and could eventually weigh on company fundamentals," David Kostin, Goldman's chief U.S. equity strategist, said in a note to clients Friday. "The valuation premium for growth is elevated today relative to history; Software in particular now carries the highest multiples since the Tech Bubble."

While the information technology sector has led this year's market rebound, up 22% versus 's 15% gain, the rally has also stretched valuations to extremely high levels. The tech sector carries a valuation premium two standard deviations above its 10-year average across a range of metrics, Goldman noted. Within tech, software stocks now have the highest multiple near the peak of the dot-com bubble, the firm said.

"History shows that stocks with the highest EV/sales ratios typically underperform peers over the long term. In general, these firms deliver the same upside as cheaper stocks when beating growth estimates, but more downside when missing forecasts," Kostin said.

Microsoft has led the run in software stocks this year, up 30% this year.

Adding to Goldman's bear case on tech is the federal government's antitrust investigation into big firms like Alphabet, Facebook and Amazon. The bank advised clients to reduce exposures to targeted companies in the event of an antitrust lawsuit.

"Markets have reflected little concern," but history shows "valuations and share prices declined between lawsuit filing and resolution," Kostin said. "The cases took years to resolve, and sales growth slowed following resolution."