a nearby bridge.
The security forces fired tear gas to force the migrants back and rounded up those who managed to make it across.
Mexico has cut off migration routes to the US under pressure from President Donald Trump.
National Guard troops with riot shields were seen trying to stop the migrants from climbing the banks of the Suchiate river, which marks the border between Mexico and Guatemala.
Some of those who were trying to reach Mexico threw stones at the police.
The detained migrants have been transferred to immigration stations. They will be returned to their home countries if their legal status cannot be resolved, the government said.
The migrants had been camped out in the Guatemalan town of Tecún Umán, across the border from Mexico's Ciudad Hidalgo.
Eight representatives of the migrants were allowed into Mexico for talks with the authorities and to pass a letter on to President Andrés Manuel López Obrador.
They urged him to let them pass and promised to respect the law.
Step into the shoes of a migrant
Why I am leaving Honduras
The US border in seven charts
Those who tried to cross the river on Monday were part of a 2,000 to 3,500-strong group dubbed "2020 Caravan", evoking previous attempts to cross Mexico en masse to reach the US border.
For its part, Guatemala said several thousand migrants had crossed into its territory from Honduras since Wednesday.
Many of the migrants on the Mexico border said they were fleeing violence, poverty and high murder rates.
"We got desperate because of the heat. It's been exhausting, especially for the children," Honduran migrant Elvis Martínez told AFP news agency.
Mexico has said they can stay and work in Mexico and apply for asylum but will not be allowed free passage to the US.
"They're trying to trick us. They tell us to register, but then they deport us," another migrant said.
The Mexican interior ministry said it had already taken in 1,100 migrants in the states of Chiapas and Tabasco. Most would be returned to their country of origin "if their situation warrants it", it added.
President Trump reached a deal with Mexico in June to stem the flow of migrants to the US after threatening it with high tariffs. Mexico agreed to take "unprecedented" steps to curb irregular migration, including deploying the National Guard.
Another agreement, with Guatemala, designates that country as a "safe third country". Under the accord, the US can send migrants from Honduras or El Salvador who pass through Guatemala back to that country to seek asylum first.
Mr Trump has made the fight against illegal migration to the US a major policy issue and has taken measures to deter entry across the border from Mexico, including plans for a border wall.