If I understand you correctly:
You have models called Product and Attribut, in an N:M relation. They will have a $has_many to oneanother. You will need a relationship table connecting the two, called Attributs_Products, containing 3 fields: ‘id’, ‘attribut_id’ and ‘product_id’. This relationship table doesn’t need a model. So your first code block is correct.
You make relations by loading the required objects, and then link them:
// get a product and an attribute
$product = new Product(1);
$attribut = new Attribut(1);
// relate the two
// get all attributes
// relate all of them to the product
If you have values that don’t belong to product or attribute, but are part of the relation, you need to add these fields to the Attributs_Products table. Use the Datamapper join_fields methods to manipulate them. See the manual for some examples.