The two are among nine arrested by police on Tuesday in the country's third-largest city, Odense, and have been charged with planning terrorist acts in the months "leading up to September 5 2006".
The judge, Ingrid Therkelsen, ruled on Wednesday that five of the others arrested were to be detained for 72 hours, saying that police lacked sufficient evidence to hold the men longer.
The two others have been released.
The seven men in detention are aged between 18 and 33 and were arrested during an overnight police raid on Tuesday in the Vollsmose neighbourhood of Odense.
Their identities have not been revealed, but all seven are Danish citizens, six of whom are of Palestinian or Iraqi origin. The seventh, an ethnic Dane, had converted to Islam.
Danish authorities have not provided any details of the target of the attacks, but said a police raid had uncovered "materials" used in the production of explosives.