Both Farrell and Safaí will wrap up the campaign season by asking voters to rank them as first and second, in an effort to knock away votes from incumbent Mayor London Breed. The venture capitalist is also asking voters to exclude Supervisor Aaron Peskin from their ballots.
WATCH: Top San Francisco mayoral candidates detail vision for city, tackling crime, homelessness and more
At a press conference announcing this alliance Monday, Farrell said he wants his supporters to not write Breed's name on their ballots.
"Mayor Breed has overseen the steepest declines San Francisco has faced in modern history," Farrell said. "That's why today I'm encouraging all of my supporters and voters across the city of San Francisco to leave London Breed and Aaron Peskin off their ballots. They've had more than six years in office to fix our city, and they failed."
The city of San Francisco uses a ranked-choice system, which is designed to allow voters to list their top candidates in order of preference. Instead of picking one single candidate, voters can list up to 10 of their top choices. If there's not a clear winner from everyone's top choice, election officials will begin tallying the second-choice votes. The process can and will continue to third and fourth choices and so on until a clear winner emerges - which requires a candidate to get more than 50% of the vote.
James Taylor, a political professor at the University of San Francisco, said candidates have to be savvy about their alliances - like what Jean Quan and Rebecca Kaplan's 2010 partnership in the race for Oakland mayor, in which Quan ultimately won in an upset against Don Perata.
RELATED: Mark Farrell details vision for city, tackling homelessness, more
"The question is, who has the best-ranked choice voting game?" Taylor said. "If you can find enough cooperation and coalition with at least one other campaign, and this is what we saw in Oakland. You had two campaigns united against Don Perata and it was 'anybody but Don' is how it was described. And that was one of the most shocking outcomes of ranked-choice voting so far in California history."
Farrell's announcement comes as a coalition of three former San Francisco mayors and other leaders are asking District Attorney Brooke Jenkins and Attorney General Rob Bonta to launch a criminal investigation into him, alleging the former Supervisor did not make investment disclosures required by law and benefited off of legislation related to those investments.
Farrell dismissed the allegations, in response to a reporter question at his press conference.
"Each of these former mayors is supporting one of my political opponents. This is the machine trying to attack me as a frontrunner in this race that is blatantly transparent and should be transparent to every single San Francisco voter. They are doing this only to support the candidates that they are backing," he said. "It has no basis in truth at all."
MORE: How leading SF mayoral candidates hope to bring businesses back downtown
In a statement to ABC7, a Breed campaign spokesman called Farrell's alliance with Safaí a "ridiculous stunt."
"Daniel Lurie's nonstop attack ads have Mark Farrell running scared and trying anything to get them to stop. This ridiculous stunt shows that Farrell's campaign is in total disarray, with his poll numbers sinking like a rock. After just a few weeks, Lurie's millions have exposed Farrell's glass jaw," said Joe Arellano, Breed's campaign spokesman.
Taylor said if anything is certain, it's the uncertainty that can come with ranked-choice voting.
"There are so many variables in terms of the campaigns, what voter preferences are, how the campaigns educate their voters, which groups are actually going to turnout?" he said.
At the very least, Taylor said due to the complexity of ranked-choice voting, San Franciscans should expect days, if not weeks, before election officials can declare an official winner.