Most people in the Caribbean nation are black.
The foreign ministry said young Bahamian men in particular should exercise caution in their dealings with police in US cities.
"Do not be confrontational and cooperate," the ministry said in a statement.
Tomorrow is a holiday in the Bahamas, so many people here were expected to use the long weekend to visit the US.
The travel warning is of the kind that the US State Department issues to Americans traveling to countries it deems dangerous.
Micah Johnson, the black gunman who killed five police and wounded seven others during a peaceful protest Thursday in Dallas, told police those earlier killings were the reason for his rampage. Police killed him by detonating a bomb carried by a robot.