We use the number of linear extensions of a given poset and some partitions, in order to obtain formulas for the number of some restricted compositions of a given multipartite number into vectors whose components are integers in arithmetic progression. These formulas allow us to obtain some relationships between the number of restricted compositions of a positive integer $n$ into parts that are either, a sum of three octahedral numbers or square numbers and the number of restricted compositions of n into parts that are either, a sum of four cubes with two of them equal or congruent to 1 (mod 6).