MEXICO CITY, NOV. 16 -- Nicaraguan President Daniel Ortega accused Costa Rica today of permitting leaders of the rebels, known as contras, to engage in "illegal political activities" in that country in violation of a peace agreement promoted by its president, Oscar Arias.

Ortega made the statement in a press conference after a meeting with Mexican President Miguel de la Madrid at the end of a weekend visit here. In the meeting, the Nicaraguan leader asked for a resumption of Mexican oil deliveries, but was told Mexico cannot give oil away and Nicaragua must pay off a $500 million oil bill it ran up before Mexican shipments were cut off in 1985, a senior Mexican official said.

Ortega's remarks about Costa Rica appeared likely to heat up a squabble about the venue for indirect cease-fire talks between the Sandinista government and the contras. After months of ruling out negotiations with the contras, Ortega last week presented an 11-point cease-fire proposal to a proposed intermediary, Nicaraguan Cardinal Miguel Obando y Bravo, in Washington.

In the press conference at the Mexican presidential office complex, Ortega repeated his demand that the indirect negotiations be held in the United States, which he said directs the "policy against Nicaragua." Cardinal Obando has suggested, however, that the negotiations be held in Central America, and Arias has said they should be held in Nicaragua. The contras have been insisting that Managua be the site.

Ortega asserted that "no Central American country can be the site of these talks" because, he argued, the peace accord signed in Guatemala Aug. 7 by five Central American presidents does not permit "political activities by persons linked to . . . insurgent forces." He added that Nicaragua regards as unacceptable the involvement of any Central American country in talks between the Sandinistas and the contras.

The Sandinista leader charged that the political activities in Costa Rica of such "CIA-employed" contra leaders as Alfonso Robelo, Pedro Joaquin Chamorro and Alfredo Cesar "are illegal" and that "under the Guatemala accord, the Costa Rican government must put these people in their place." The three are directors of the Nicaraguan Resistance, the contras' political umbrella group, and live in exile in the Costa Rican capital.

Asked about the presence in Managua of Salvadoran rebel leaders, Ortega said that "Nicaragua isn't the only one required to comply" with the Central American peace accord and that all five signatories were obliged to "take simultaneous actions" to meet its requirements.

Ortega's demand that the cease-fire negotiations be held in the United States was seen as a fallback position from his earlier insistence on bilateral talks with the Reagan administration instead of any dealings with the contras. Now, however, the Sandinista government appears to contend that the Guatemala peace accord does not permit peace talks to be held in Central America.

Asked why Nicaragua could not follow the example of Salvadoran President Jose Napoleon Duarte, who held an initial round of direct cease-fire negotiations with rebels last month in San Salvador, Nicaraguan Vice President Sergio Ramirez would say only that the two countries' situations were different. In Managua Friday night, Ramirez noted to reporters that talks between Guatemalan government and rebel representatives last month were held in Madrid.

In today's news conference, Ortega said Nicaragua was "seeking formulas" that would permit the resumption of oil deliveries from Mexico under a regional agreement known as the San Jose accord. However, that accord requires oil-receiving countries to be current on payments for previous deliveries.