This page contains information regarding Star Trek: Lower Decks, and thus may contain spoilers.
Upon successfully capturing James T. Kirk and taking over the Elba II asylum, in 2269, Lord Garth referred to the asylum's occupants as ants, stating in one of his many tyrannical speeches that, "galaxies surround us, limitless vistas, and yet the Federation would have us grub away, like some ants on some, somewhat larger than usual anthill! But I am not an insect! I am master of the universe, and I must claim my domain." (TOS: "Whom Gods Destroy")
Ants lived in units called colonies. In 2269, the Lactrans were described by Spock as appearing to be "as advanced beyond Earth civilization as Humans are from a colony of ants." (TAS: "The Eye of the Beholder")
While attempting to correct the orbit of the Bre'el IV moon, in 2366, Captain Jean-Luc Picard wondered if there was any way that the USS Enterprise-D could "coax that satellite back where it belongs?" Chief Engineer Geordi La Forge figured that the ship would need "a delta-vee of four kilometers per second," a task that "even with warp power would mean exceeding the recommended engine output by 47 percent." He then analogized the scenario, describing the task as being comparable to "an ant pushing a tricycle. A slim chance at best." (TNG: "Deja Q")
When the crew of Deep Space 9 pondered the destiny of a protouniverse in 2370, one of the options given was to have it destroyed. Odo argued that destroying the civilization would be committing mass murder. Kira Nerys justified the act as being "like stepping on ants," to which Odo replied, "I don't step on ants, major." (DS9: "Playing God")
In 2381, Commander Jack Ransom gained god-like superpowers after exposure to strange energy, and said that, compared to Gary Mitchell's similar experience, "Gary Mitchell was an ant, and I am a lion!" (LD: "Strange Energies")