Robert Peck decides to cut school after another boy makes fun of his clothes during recess. On the way, home, he discovers one of his neighbor's cows, Apron, in the middle of giving birth to a calf. After trying and failing to pull the calf out several times, Robert succeeds by taking off his pants and tying one leg around the calf's head and the other around its neck. The calf comes out in a heap all over Robert, but its mother is still in trouble. Seeing that she is having trouble breathing, Robert shoves his hand way down the cow's throat and discovers a goiter. He tries to pull the ball out, but Apron bites him and drags him all over the countryside.
When Robert wakes up, Mr. Tanner, the neighbor whose calf he just helped, is carrying him into the house. Robert's mother, Lucy; father, Haven; and Aunt Carrie tend to his wounds and promise to right whatever trouble Robert had caused. Mrs. Peck sews Robert up, and as they are tucking him into bed Robert explains what happens. The next day, Haven comes up to Robert's room and gives him a winter apple, some gum, and a whistle. Though Haven scolds his son for skipping school, he is clearly proud of his son's heroism in helping the calves.
Robert is bedridden for most of the week and finally comes downstairs for breakfast on Saturday morning. His father puts him back to work immediately, and while they are out mending a fence, Benjamin Tanner approaches them. As it turns out, Apron has had two calves, not just one. Benjamin thanks Robert and gives Robert a baby pig for his trouble. Robert immediately names the pig Pinky, and the two become best friends. Robert soon learns that owning a pig is not easy, as Haven explains that they will have to build Pinky a home away from the other animals. After dinner, they discover an old corn cratch near the barn, which would make a nice house. To make sure that Pinky will not bother the other animals, Robert and Haven set up a capstan, which their ox, Samson, uses to move the cratch to a suitable location.
School finally ends, and Robert runs home to Pinky. When he gets there, Mrs. Peck is waiting for him and ushers him inside because Robert's Aunt Matty is over for a visit. Robert greets her, and then shows his mother, Aunt Carrie, and then Aunt Matty his report card. As the only one among them who can read, Matty is shocked by the 'D' that Robert has gotten in English, even though he got 'A's in every other subject. She decides on the spot that she is going to tutor Robert and drags him into the parlor for a first lesson. Aunt Matty immediately determines the problem and tries to teach Robert how to diagram sentences. When he cannot, Matty simply does it all for him. She tells him to go hang the diagram on his wall, and Robert does what he is told.
After chores that day, Robert and Pinky go for a walk on the ridge between their property and the Tanners'. They watch an eagle hunt and kill a rabbit and take in the beauty of the sunset. Later that night while Robert is sleeping, he is awakened by the sound of rain and voices downstairs. Eavesdropping, he learns that Mrs. Hillman has come over in some distress over her husband. Haven then comes in from outside and calls up to Robert to get dressed and yoke up Samson to the wagon. He does this without a word, and then he and Haven, armed with shotgun and lantern, head toward Learning. Reaching town, they go to the churchyard and discover Mr. Hillman digging up a grave. He is digging up the baby of a love affair that he had once had with one of Mr. Peck's kin so that he can expose his sin to the rest of the world. When Haven sees that Hillman does not plan on desecrating the grave of his kin, he helps Mr. Hillman finish. With the coffin in tow, they all head back to the Peck place for breakfast.
One day, sometime later, while Robert is finishing up his chores, Haven comes home from the slaughterhouse and tells Robert that the Tanners had invited him to travel with them to the Rutland Fair. This is big news to Robert, who had been dreaming of taking Pinky to the fair so that she might win a blue ribbon. Two days ago, Robert had helped out another neighbor, Mrs. Iris Bascom, move some flower pots, and when he was finished, she brought him some milk and cookies. Over the cookies, Robert had mentioned how he wanted to go to Rutland, and somehow this had gotten back to the Tanners.
The day of the fair finally arrives. Haven drops Robert off at the Tanners' place, asking him to remember his manners. The Tanners and Robert arrive at Rutland in no time, thanks to the power of Mr. Tanner's twin horses. They head for the stalls where the livestock is kept. The cattle showing is first, so they yoke up Bib and Bob, the calves that Robert assisted in birth, and head for the ring. When their names are called, Robert walks the oxen around the ring three times to the cheers of the crowd. When the show is over, Mrs. Tanner runs up and tells Robert that the children's pig judging will be happening in any minute. She minds the oxen while Robert and Mr. Tanner hurry back to get Pinky. After washing her down, they race over to the judging area, and they get there just in time. Pinky wins a ribbon for being the best-behaved pig at the fair, but Robert doesn't find out until later—when the judge comes over, Robert throws up all over his shoes.
When Robert gets home, he talks about Rutland non-stop until his parents force him to go to bed. In the night, Robert hears a commotion in the hen house but is too tired to find out what had happened. In the morning, Mr. Peck reveals that last night a weasel had gotten into the hen house and killed a chicken. Haven then shows him the captured weasel, and Robert suggest they ask Ira Long, Mrs. Bascom's hired hand, if he wants to test his dog against it. Ira does, and arrives later that afternoon. When Robert asks, Haven explains that farmers weasel their dogs so that the dogs will know to protect the chickens if one ever tries to get into the hen house. With no more questions, the dog and the weasel are thrown in a barrel, and Robert slams on the lid. Such a fight ensues that Ira has to help Robert hold the barrel upright. When the lid comes off, a terrible cry escapes, and Robert sees that there is not much of the dog left. Understanding its pain, Robert orders Ira to put a bullet in the dog before he does it himself, and though Ira objects, Haven backs his son up and then does the job himself, swearing never to weasel another dog as long as he lives.
When Pinky gets home from the fair, Mr. Peck takes a look at her and gives Robert some bad news. He was starting to believe that Pinky might be barren because she should have had her first heat by now. This upsets Robert greatly because he had hoped that Pinky would become a brood sow and therefore avoid ever being eaten. Later in the evening, Haven gives Robert more bad news. He believes that he has an affliction of some sort and that the coming winter will be his last. He tells Robert that he is going to have to be the man of the house, which upsets Robert, but Haven just goes up to bed.
The next day, while working, Robert runs into Mr. Tanner and explains the situation with Pinky. Later in the afternoon, Mr. Tanner brings his prize boar over to court with Pinky and prove whether she is barren or not. After a lot of foreplay, Samson forces himself on Pinky to Robert's horror. Mr. Tanner explains that is the way it always is at first, and then he elaborates on the glory of animal husbandry and how Pinky could be the Pecks' road to financial stability. All of this confuses Robert, but it also gives him hope.
Pinky does turn out to be barren, however, and as winter approaches it becomes obvious that they are going to have to kill her. Finally, one gray November morning they decide to do it. They head to the tackroom, and Robert gives Pinky one last hug before Haven knocks her out and kills her. Robert hates his father in that moment, but when they are finished, Robert sees that his father's heart is broken, just like his own. Robert then forgives Haven. He kisses his father's hand and, for the first and last time, sees his father cry.
Haven dies in his sleep in May of the next year. Robert finds him lying peacefully in the barn and tells him that there is no need for him to get up. He finishes the chores and then tells Mrs. Peck and Aunt Carrie what happened and what they have to do. Robert goes into town and makes arrangements with the county coroner for the funeral. The service is short and sweet, and many more people come out than Robert has expected or invited. They bury Haven in the family plot near the apple orchard, and then they go their separate ways. In the time before and after the service, Robert finds random chores to keep him busy and keep his mind off of what had happened. In the tackroom, he finds a piece of paper and pencil, where his father had been trying to learn how to write his name. Near the end of the page, he had almost got the hang of it.
Finally it is time to go to bed, and Robert comforts Mrs. Peck and Aunt Carrie. He cannot fall asleep himself, however and eventually finds himself walking out toward the apple orchard. When Robert reaches his father's grave he simply says, "Goodnight, Papa. Thanks for thirteen good years," and he walks back inside.