According to most scholars, atheism is a part of Hinduism. However, are there any verses in the Puranas or the Mahabharata that condemn atheism?
Atheism and atheists are condemned in all scriptures.
12.33. Covetousness, sleepiness, pusillanimity, cruelty, atheism, leading an evil life, a habit of soliciting favours, and inattentiveness, are the marks of the quality of Darkness (Tamas).
4.163. Let him avoid atheism, cavilling at the Vedas, contempt of the gods, hatred, want of modesty, pride, anger, and harshness.
11.66. Stealing grain, base metals, or cattle, intercourse with women who drink spirituous liquor, slaying women, Sudras, Vaisyas, or Kshatriyas, and atheism, (are all) minor offences, causing loss of caste (Upapataka).
2.11. Every twice-born man, who, relying on the Institutes of dialectics, treats with contempt those two sources (of the law), must be cast out by the virtuous, as an atheist and a scorner of the Veda.
3.150. Manu has declared that those Brahmanas who are thieves, outcasts, eunuchs, or atheists are unworthy (to partake) of oblations to the gods and manes.
8.22. That kingdom where Sudras are very numerous, which is infested by atheists and destitute of twice-born (inhabitants), soon entirely perishes, afflicted by famine and disease.
8.309. Know that a king who heeds not the rules (of the law), who is an atheist, and rapacious, who does not protect (his subjects, but) devours them, will sink low (after death).
All Verses from Manu Smriti.
In all these verses given above
NAstikyam is the original Sanskrit word, translation of which is given as atheism.
One, who is given to the vilification of the Vedas , one who is given to speaking against the Deities ; one, who is given to speaking ill of the twice-born ; [all these] should be avoided in all rites appertaining to a S'raddha. (34)
An ungrateful person ; a deceitful person ; a wicked soul ; an atheist ; one, who speaks against the Vedas ; one, who slays a friend ; one, who knows another's wife ; one, who falsely accuses a learned person ; [should, also, be avoided.] (35)
Usana Smriti verses.
[An ideal wife] She should not be prodigal in her purse, nor hostile to the spirit of piety or gain. Carelessness, fickleness of mind, anger, envy, deception, vanity, rivalry, mischievousness, cruelty, inordinate pride, cunningness,. atheism, daringness, discontent, and dissimulation are the fifteen vices which a chaste wife should always try to renounce.
VyAsa Smriti chapter 2 verses.
Atheism also means not following the path of Vedas as per Hindu scriptures. Vishnu Purana strongly condemn atheism(rejecting Vedas) and even declare death penalty for rejecting Vedas.
When the mighty Vishńu heard their request, he emitted from his body an illusory form, which he gave to the gods, and thus spake This deceptive vision shall wholly beguile the Daityas, so that, being led astray from the path of the Vedas, they may be put to death; for all gods, demons, or others, who shall be opposed to the authority of the Veda, shall perish by my might, whilst exercised for the preservation of the world.
Hindu scriptures also say one shouldn't have contact with unbelievers of god:
The company of non-believers should be left in the same way, as the person runs away in panic at the sight of a terrible snake.