Lets say humans would want to populate Mars with ants. Would it be possible for an ant colony to create a self sustaining ecosystem underground on Mars, by for example farming fungi, like some ants do? How could a project like this be implemented? And is there a conceivable reason for humans to want do so? Also which species of ant has the best chances?
Not on Mars as it is today.
The temperature is too low (it averages -63 C, with peaks of 20 C in summer and -140 C in winter), the atmospheric pressure is too low (6 mbar, even lower than on the top of Mount Everest) and there is not enough liquid water. No Earth life form can thrive in those conditions.
Maybe some bacteria can stay in suspended animation, but nothing more.
Moreover, Martian soil is toxic
Martian soil is toxic, due to relatively high concentrations of perchlorate compounds containing chlorine. Elemental chlorine was first discovered during localised investigations by Mars rover Sojourner, and has been confirmed by Spirit, Opportunity and Curiosity. The Mars Odyssey orbiter has also detected perchlorates across the surface of the planet.
Ants require air at suitable pressure and temperature containing sufficient oxygen, plus water and food to live.
On Mars, there is virtually no air pressure (usually less than 1% of Earth air). There is virtually no unbound oxygen on Mars, and while there is some water, it is always either a gas or that white crunchy stuff, neither of which help the ants much. Also, if you put ants on Mars, the only food on Mars will be... dead ants.
You need to put your aim a bit lower than ants. Some lichens can survive, but not live, on the Mars surface. In the deepest canyons on a balmy summer day they might, just might, even be able to live and grow.
Soil bacteria, of the type that use anaerobic metabolic pathways, should manage just fine below the Martian surface. Things like the sulfur-eating microbes.
They would live below the surface, protected from the surface temperature extremes, radiation and vacuum. They would derive energy from "eating" sulphur-containing minerals. Here on Earth we encounter such bacteria in geothermal vents, deep in mines, and similarly strange places.
Unfortunately no, these do not make a suitable base upon which to build a food chain. The rate of growth is very low, the bacteria and their residue and excretions is deadly poison to aerobic life, they are simply not compatible. The closest encounter you are likely to have with an anaerobic bacterium is called "Gangrene"