An envelope addressed to President Carter and containing an explosive or incendiary device was discovered yesterday afternoon at the White House mailroom inside the Executive Office Building, District police and U.S. Secret Service spokesmen reported.

The District police bomb squad removed the envelope and its contents by truck to an undisclosed location, dismantled the device and reported that it was "capable of explosion," police spokesmen said.

Secret Service spokesmen said there was evidence the device may have detonated at least partly somewhere in the mails before its discovery. They said the device was in a 6-by-9-inch manila envelope, but declined to discuss the postmark or any other clues of its origin pending further investigation.

Secret Service agents discovered the envelope in the mailroom about 2:45 p.m. yesterday, a spokesman said, and the city police bomb squad was called to the scene.

The Secret Service spokesmen were unable to say whether this was the first such incident since President Carter took office in January.

Last Dec. 6, District police reported discovery of an explosive device in a package in the mailroom of Carter's transition headquarters in a Health. Education and Welfare Department building at 300 Independence Ave. SW.

That device was detected through electronic equipment used to screen all incoming mail. Police dismantled the device and said it had malfunctioned and failed to detonate.