NEW YORK (AP) _ Long distance was not the next best thing to being there for five Dominican nationals accused by federal authorities of selling more than $1 million in illegal overseas telephone calls.

The arrests followed a probe by New York Telephone Co. investigators, Secret Service agents and security personnel from long distance telephone companies, Richard Ward, special agent in charge of the Secret Service's New York office, said Thursday.

The five, who operated out of four Manhattan apartments, allegedly charged customers from $5 to $20 to make long distance calls, mostly to the Dominican Republic, Colombia and elsewhere in Latin America, Ward said. The customers made the calls from one of the apartments.

If convicted, they face a maximum penalty of 15 years in prison and fines of $50,000 or twice the value of the fraudulent activity, Ward said. Their cases will be prosecuted by the office of U.S. Attorney for the Southern District of New York, Rudolph W. Giuliani.

''They avoided the usual billing procedures by utilizing 'blue boxes' and stolen or compromised personal identification numbers or credit card numbers issued by various telecommunications companies,'' Ward said.

A ''blue box'' is an illegal, electronic device, about the size of a pocket calculator with a push-button keypad like that on a telephone. The push buttons mimic the frequencies used by telephone companies and enable the caller to bypass phone company billing equipment.

Secret Service agents with federal search warrants seized four ''blue boxes,'' more than 20 telephones, and hundreds of personal identification numbers and stolen credit card numbers, Ward said.

Everick Bowens, president of the Communications Fraud Control Association, estimated fraud losses in the telecommunications industry in 1984 at $500 million, $70 million in the New York City area. Blue box fraud is a particular problem in New York City, although the bulk of the $70 million lost in New York is through other methods, he said.

This case marked the first time the Secret Service and the U.S. attorney's office have cooperated to prosecute under a federal law passed in October 1984 entitled Fraud and Related Activity in Connection with Access Devices.