God only imputes sin on living things that have a creative mind capable of reasoning, making choices, and who possess (at minimum) a basic understanding of the difference between right and wrong. Beings such as humans and angels meet these criteria, although there does exist a large subset of humans that are not held accountable concerning sin.
There are many things made by the Eternal, in spite of the pain and sufferings they can sometimes cause, that he does not impute as committing a sin.
Inanimate (lifeless, inorganic) objects cannot sin because they do not possess a mind and therefore cannot make choices. This large class of objects includes everything from rocks to clocks and grains of sand to entire galaxies. They behave and interact based on physical laws placed in motion when everything was created.
Plants, although they are alive, cannot sin as they lack a mind and therefore cannot reason. Their existence (how they grow, adapt, etc.) is governed, like inanimate objects, based upon rules put in place before their initial creation.
Animals, even though they (in varying degrees) possess the ability to adapt and learn, also cannot transgress God's law. Their lives, which can exhibit complex behaviors, are governed by a sophisticated program placed in each of them we call instinct.
Humans in the womb, babies and young children (up to the time they begin to understand the basic difference between good and bad) do not have sin imputed to them. For example, the Apostle Paul states that God determined Esau would serve Jacob before they were born and had any chance to do good or evil.
But before the children had been born, or had done anything good or evil (in order that the purpose of God according to His own selection might stand - not of works, but of Him Who calls), it was said to her, "The elder shall serve the younger." (Romans 9:11 - 12, HBFV).
Age of Accountability
Many human governments, in modern times, have set up laws specifying an "age of criminal responsibility" where a person is deemed old enough to understand right from wrong (sin) and therefore be held criminally accountable for their actions. These ages can, of course, vary. For example, under English common law, a child under seven years old was presumed incapable of committing a crime. In England this age is considered under ten years old while in Scotland, as of 2020, this age is under twelve (Wikipedia).
Ultimately, it is up to God to determine on an individual basis when a person is old enough to understand right from wrong and be held accountable for sin. That said, an excellent Biblical example of an age, at the time, when people were considered old enough to be held accountable for sin took place after the Lord freed ancient Israel from Egyptian slavery.
Refusing the Promised Land
God had Moses send twelve spies into the Promised Land (Numbers 13). Ten of the twelve spies, upon their return, gave a fearful and faithless report regarding Israel's chances of claiming their land inheritance. Although two of the spies urged the people to have faith that the Lord would insure their victory, the Israelites chose to reject claiming their inheritance and instead wanted to go back to Egypt (Numbers 14)!
God's punishment upon Israel for refusing to enter the Promised Land was severe. He determined that all those twenty years old or older knew right from wrong and therefore would be held accountable for committing a sin against him by refusing to enter the land he promised. Those who were under twenty, however, were considered young enough to have "no knowledge between good and evil." They would be the ones who, under Joshua, would enter the "land of milk and honey."
And your little ones (Israel's children), who you said would be a prey, and your children who in that day had no knowledge between good and evil, they shall go in there. And I will give it to them, and they shall possess it. (Deuteronomy 1:39, HBFV).
Your dead bodies shall fall in this wilderness, and all that were numbered of you, according to your whole number, from twenty years old and upward, who have murmured against Me . . .
But your little ones, which you said should be a prey, I will bring them in and they shall know the land which you have despised. But as for you, your carcasses shall fall in this wilderness. (Numbers 14:29, 31 - 32, HBFV).